public HttpResponseMessage GetByMonth([FromUri] CalendarSessionRequest model) { ItemsResponse <CalendarSession> response = new ItemsResponse <CalendarSession>(); response.Items = _svc.GetByMonth(model); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public List <CalendarSession> GetByMonth(CalendarSessionRequest model) { List <CalendarSession> item = null; _prov.ExecuteCmd("SelectSessionByDateAndRole", inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@PersonId", model.PersonId); paramCollection.AddWithValue("@CriteriaStartDate", model.CriteriaStartDate); paramCollection.AddWithValue("@CriteriaEndDate", model.CriteriaEndDate); }, singleRecordMapper : delegate(IDataReader rdr, short set) { switch (set) { case 0: CalendarSession s = new CalendarSession(); int ord = 0; s.PersonId = rdr.GetSafeInt32(ord++); s.SessionId = rdr.GetSafeInt32(ord++); s.SessionName = rdr.GetSafeString(ord++); s.StartDatetime = rdr.GetSafeDateTime(ord++); s.EndDatetime = rdr.GetSafeDateTime(ord++); if (item == null) { item = new List <CalendarSession>(); } item.Add(s); break; default: break; } } ); return(item); }