public HttpResponseMessage Post(HenDepreciation value)
        {
            HttpResponseMessage response = null;

            ValidateModel(value);

            if (!ModelState.IsValid)
            {
                response = Request.CreateResponse(HttpStatusCode.BadRequest, GetModelErrors());
                return(response);
            }

            try
            {
                service.Save(value);
                response = Request.CreateResponse(HttpStatusCode.Created, value);
                string uri = Url.Link("DefaultApi", new { id = value.Id });
                response.Headers.Location = new Uri(uri);
            }
            catch (Exception ex)
            {
                response = Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);
            }

            return(response);
        }
 public override void Execute(object parameter)
 {
     try
     {
         service.Save(Depreciation);
         broker.Publish(CommonMessages.SaveHenDepreciationSuccess, Depreciation);
     }
     catch (Exception ex)
     {
         broker.Publish(CommonMessages.SaveHenDepreciationFailed, new Error
         {
             Data      = Depreciation,
             Exception = ex
         });
     }
 }