using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Maxi.DataServices {
public class DailyStocktakeData {
public Guid ID { get; set; }
public DateTime CreatedOn { get; set; }
public string Name { get; set; }
public string CompletedByUsername { get; set; }
}
}
[WebGet]
public IQueryable<DailyStocktakeData> GetDailyStocktakes(string UserID, string CentreID) {
Guid userID = new Guid(UserID);
Guid centreID = new Guid(CentreID);
var db = new MaxiContext();
var query1 = from stocktake in db.Stocktakes
join dailyStocktakeSetting in db.DailyStocktakeSettings on stocktake.DailyStocktakeSettingID equals dailyStocktakeSetting.ID
where stocktake.CreatedByUserID == userID && stocktake.SourceCentreID == centreID
select new DailyStocktakeData {
ID = stocktake.ID,
CreatedOn = stocktake.CreatedOnUTC,
Name = dailyStocktakeSetting.Name
};
return query1;
}
Sample Url
http://localhost:49423/DataService/NamaMethod?UserID=%277d43a7da-68e6-4ff4-8d5f-a7180147cd8a%27&CentreID=%27ecad2936-9622-4903-9719-a8b200e74ce7%27
Jangan lupa dikasih '' pada parameter
Cek di DataSources.cs