public HttpResponseMessage Search([FromUri] ExceptionSearchRequest model) { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState)); } int resultCount = 0; SearchResponse <Domain.Exception> response = new SearchResponse <Domain.Exception>(); response.Items = ExceptionLoggingService.Search(model, out resultCount); response.ResultCount = resultCount; return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public static List <Domain.Exception> Search(ExceptionSearchRequest request, out int totalResults) { List <Domain.Exception> list = null; int totalRows = 0; DataProvider.ExecuteCmd(GetConnection, "dbo.ExceptionLog_Search", inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Type", request.Type ?? String.Empty); paramCollection.AddWithValue("@Message", request.Message ?? String.Empty); paramCollection.AddWithValue("@StackTrace", request.StackTrace ?? String.Empty); paramCollection.AddWithValue("@Url", request.Url ?? String.Empty); paramCollection.AddWithValue("@Person", request.Person ?? String.Empty); paramCollection.AddWithValue("@StartDate", request.StartDate); paramCollection.AddWithValue("@EndDate", request.EndDate); paramCollection.AddWithValue("@CurrentPage", request.CurrentPage); paramCollection.AddWithValue("@ItemsPerPage", request.ItemsPerPage); }, map : (Action <IDataReader, short>) delegate(IDataReader reader, short set) { switch (set) { case 0: Domain.Exception ex = MapException(reader, out totalRows); if (list == null) { list = new List <Domain.Exception>(); } list.Add(ex); break; } } ); totalResults = totalRows; return(list); }