public static GetAgencyNameResponse GetAgencyNames(GetAgencyNameRequest request) { GetAgencyNameResponse response = new GetAgencyNameResponse(); try { if (!SuperUserServices.CheckSuperUser(request.user_id, request.auth_token, response)) { response.message = MessagesSource.GetMessage("invalid.super.user"); return(response); } response.agency_names = new List <GetAgencyNameDto>(); using (AgencyDao dao = new AgencyDao()) { var agencyList = dao.GetAgencies(); if (agencyList != null && agencyList.Count > 0) { response.agency_names = agencyList.Select(r => new GetAgencyNameDto { agency_id = r.AgenID, agency_name = r.AgencyName }).ToList(); } response.code = 0; response.has_resource = 1; response.message = MessagesSource.GetMessage("agencies.listed"); return(response); } } catch (Exception ex) { response.MakeExceptionResponse(ex); return(response); } }
public NegotiatedContentResult <GetAgencyNameResponse> PostAgencyNames([FromBody] GetAgencyNameRequest request) { GetAgencyNameResponse resp = ReportsServices.GetAgencyNames(request); return(Content(HttpStatusCode.OK, resp)); }