public HttpResponseMessage GetByName(HighSchoolTypeAheadRequestName model) { if (model == null) { ModelState.AddModelError("", "You did not send any body data!"); } if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } List <HighSchoolTypeAheadRequest> highSchoolTypeAhead = highSchooltypeAheadService.GetByName(model); ItemsResponse <HighSchoolTypeAheadRequest> itemsResponse = new ItemsResponse <HighSchoolTypeAheadRequest>(); itemsResponse.Items = highSchoolTypeAhead; return(Request.CreateResponse(HttpStatusCode.OK, itemsResponse)); }
public List <HighSchoolTypeAheadRequest> GetByName(HighSchoolTypeAheadRequestName model) { string holder = Utils.ConvertStringToLikeExpression(model.Name); List <HighSchoolTypeAheadRequest> results = new List <HighSchoolTypeAheadRequest>(); dataProvider.ExecuteCmd( "HighSchool_Type_Ahead_Search", inputParamMapper: param => { param.AddWithValue("@Name", holder); }, singleRecordMapper: (reader, resultSetNumber) => { HighSchoolTypeAheadRequest highSchoolTypeAhead = new HighSchoolTypeAheadRequest(); highSchoolTypeAhead.Name = (string)reader["Name"]; highSchoolTypeAhead.Id = (int)reader["Id"]; results.Add(highSchoolTypeAhead); }); return(results); }