Exemplo n.º 1
0
        public HttpResponseMessage Delete(long id)
        {
            HttpResponseMessage response = null;

            try
            {
                if (IsAdminPermission())
                {
                    bool isSuccess = false;
                    isSuccess = establishmentService.DeleteEstablishmentById(id);
                    if (isSuccess)
                    {
                        response = Request.CreateResponse(HttpStatusCode.OK, "Entity removed successfully.");
                    }
                }
                else
                {
                    response = Request.CreateResponse(HttpStatusCode.Unauthorized);
                }
            }
            catch (Exception ex)
            {
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);
            }
            return(response);
        }