Hi
I have below query & i want to create API using httpresponsemessage
LMSDBDataContext context = new LMSDBDataContext();
var Result = (from t in context.View_SessionDeliveryCalendarDetails_Students
from t2 in context.View_BookDetails
where (int)t.BookID == (int)t2.ID
&& t.CurrentStatus == "Due" && t.SessionDate.Value.Date >= frDate && t.SessionDate.Value.Date <= toDate
&& (ddlDeliveryStatus.SelectedValue != "" ? t.BookDeliveryStatus == ddlDeliveryStatus.SelectedValue : 1 == 1)
&& t.BookID != 65 //&& t.SessionType == "Regular"
orderby t.Name
select new
{
t.GroupName,
t.SessionDate,
t.BookTitle,
t2.AmazonName,
t2.AmazonURL,
GrpName = t.SessionType == "Regular" ? t.GroupName : t.LeadNumber
}).ToList();
Similar to like below concept
public HttpResponseMessage GetSessionSchedule(String APIKey, DateTime FromDate, DateTime ToDate, Int32 MentorID, Int32 GroupID)
{
BALSessionDeliveryCalendar bALSessionDeliveryCalendar = new BALSessionDeliveryCalendar();
List<View_SessionDeliveryCalendarDetail> Result = bALSessionDeliveryCalendar.GetSessionSchedule((DateTime)FromDate, (DateTime)ToDate, MentorID, GroupID);
return Request.CreateResponse(HttpStatusCode.OK, Result, Configuration.Formatters.JsonFormatter);
}
Thanks