public HttpResponseMessage GetByName(SchoolTypeAheadRequestName idModel) { if (idModel == null) { return(Request.CreateErrorResponse( HttpStatusCode.NotAcceptable, "No data was sent to the server.")); } ; if (!ModelState.IsValid) { return(Request.CreateErrorResponse( HttpStatusCode.BadRequest, ModelState)); } ; List <SchoolTypeAheadRequest> eventmodel = schooltypeAheadService.GetByName(idModel); ItemsResponse <SchoolTypeAheadRequest> itemsResponse = new ItemsResponse <SchoolTypeAheadRequest>(); itemsResponse.Items = eventmodel; return(Request.CreateResponse(HttpStatusCode.OK, itemsResponse)); }
public List <SchoolTypeAheadRequest> GetByName(SchoolTypeAheadRequestName requestName) { string holder = Utils.ConvertStringToLikeExpression(requestName.Name); List <SchoolTypeAheadRequest> results = new List <SchoolTypeAheadRequest> (); dataProvider.ExecuteCmd( "School_Type_Ahead_Search", inputParamMapper: param => { param.AddWithValue("@Name", holder); }, singleRecordMapper: (reader, resultSetNumber) => { SchoolTypeAheadRequest eventmodal = new SchoolTypeAheadRequest(); eventmodal.SchoolName = (string)reader["SchoolName"]; eventmodal.Id = (int)reader["Id"]; results.Add(eventmodal); }); return(results); }