public HttpResponseMessage GetDetail(HttpRequestMessage request, string id) { return(CreateHttpResponse(request, () => { HttpResponseMessage response = null; var model = _appRoleService.GetDetail(id); var modelVm = Mapper.Map <AppRole, ApplicationRoleViewModel>(model); response = request.CreateResponse(HttpStatusCode.OK, modelVm); return response; })); }
public HttpResponseMessage Details(HttpRequestMessage request, string id) { if (string.IsNullOrEmpty(id)) { return(request.CreateErrorResponse(HttpStatusCode.BadRequest, nameof(id) + " không có giá trị.")); } AppRole AppRole = _appRoleService.GetDetail(id); if (AppRole == null) { return(request.CreateErrorResponse(HttpStatusCode.NoContent, "No group")); } return(request.CreateResponse(HttpStatusCode.OK, AppRole)); }