public HttpResponseMessage Show(long id) { HttpResponseMessage response = null; try { Domain.Establishment mEstablishment = establishmentService.GetEstablishmentById(id); if (mEstablishment == null) { response = Request.CreateResponse(HttpStatusCode.NotFound, "Requested entity was not found in database."); } else { response = Request.CreateResponse(HttpStatusCode.OK, mEstablishment); } } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
public HttpResponseMessage Create(Domain.Establishment mEstablishment) { HttpResponseMessage response = null; try { if (IsAdminPermission()) { mEstablishment = establishmentService.SaveEstablishment(mEstablishment); response = Request.CreateResponse(HttpStatusCode.OK, mEstablishment); } else { response = Request.CreateResponse(HttpStatusCode.Unauthorized); } } catch (Exception ex) { response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message); } return(response); }