public HttpResponseMessage Get() { ReasonList ReasonList = new ReasonList(); try { var list = GInfraEntities.sp_ReasonsList().ToList(); if (list.Count > 0) { foreach (var k in list) { ReasonListResponse ReasonListResponse = new ReasonListResponse(); ReasonListResponse.id = k.id.ToString(); ReasonListResponse.Reasons = k.reasons.ToString(); ReasonList.Data.Add(ReasonListResponse); } ReasonList.Status = true; ReasonList.Message = "Data Fetched Successfully"; return(Request.CreateResponse(HttpStatusCode.OK, ReasonList)); } else { ReasonList.Status = false; ReasonList.Message = "No Record Found"; return(Request.CreateResponse(HttpStatusCode.OK, ReasonList)); } } catch (Exception ex) { ReasonList.Status = false; ReasonList.Message = "" + ex + ""; return(Request.CreateResponse(HttpStatusCode.InternalServerError, ReasonList)); } }