public HttpResponseMessage Search([FromUri] TimecardEntrySearchRequest model) { ItemsResponse <TimecardEntry> response = new ItemsResponse <TimecardEntry>(); response.Items = _timecardEntry.Search(model); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public List <TimecardEntry> Search(TimecardEntrySearchRequest model) { List <TimecardEntry> list = null; DataProvider.ExecuteCmd(GetConnection, "dbo.TimecardEntry_Search", inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Id", model.Id); paramCollection.AddWithValue("@ProjectId", model.ProjectId); paramCollection.AddWithValue("@PersonId", model.PersonId); paramCollection.AddWithValue("@TimecardStatusId", model.TimecardStatusId); paramCollection.AddWithValue("@StartDateTimeUtc", model.StartDateTimeUtc); paramCollection.AddWithValue("@StartDateTimeLocal", model.StartDateTimeLocal); paramCollection.AddWithValue("@EndDateTimeUtc", model.EndDateTimeUtc); paramCollection.AddWithValue("@EndDateTimeLocal", model.EndDateTimeLocal); } , map : delegate(IDataReader reader, short set) { switch (set) { case 0: TimecardEntry a = new TimecardEntry(); int ord = 0; //startingOrdinal a.Id = reader.GetSafeInt32(ord++); a.ProjectId = reader.GetSafeInt32(ord++); a.ProjectName = reader.GetSafeString(ord++); a.FirstName = reader.GetSafeString(ord++); a.LastName = reader.GetSafeString(ord++); a.PersonId = reader.GetSafeInt32(ord++); a.TimecardStatusId = reader.GetSafeInt32(ord++); a.Status = reader.GetSafeString(ord++); a.ProjectStatus = reader.GetSafeString(ord++); a.StartDateTimeUtc = reader.GetSafeUtcDateTime(ord++); a.StartDateTimeLocal = reader.GetSafeDateTime(ord++); a.EndDateTimeUtc = reader.GetSafeUtcDateTime(ord++); a.EndDateTimeLocal = reader.GetSafeDateTime(ord++); if (list == null) { list = new List <TimecardEntry>(); } list.Add(a); break; } } ); return(list); }