示例#1
0
        public HttpResponseMessage Delete(Guid id)
        {
            try
            {
                bool isSuccess = SourceData.DeleteEntity(id);

                if (isSuccess)
                {
                    return(Request.CreateResponse(HttpStatusCode.OK));
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Entity With id:" + id + " Dont Exsist"));
                }
            }
            catch (Exception ex)
            {
                Logger.Fatal("DeleteEntity function in EntityController" + ex.InnerException);
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Something Happend" + ex.InnerException.ToString()));
            }
        }