Esempio n. 1
0
 public IHttpActionResult Post(ProcurementModel model)
 {
     try
     {
         Procurement procurement = Factory.Create(model);
         UnitOfWork.Procurements.Insert(procurement);
         UnitOfWork.Commit();
         return(Ok(Factory.Create(procurement)));
     }
     catch (Exception ex)
     {
         LogHelper.Log(ex.Message, "ERROR");
         return(BadRequest(ex.Message));
     }
 }
Esempio n. 2
0
 public IHttpActionResult Post([FromBody] ProcurementModel model)
 {
     try
     {
         Procurement procurement = Factory.Create(model);
         UnitOfWork.Procurements.Insert(procurement);
         UnitOfWork.Commit();
         Update(procurement.Product.Id);
         return(Ok(Factory.Create(procurement)));
     }
     catch (DbEntityValidationException ex)
     {
         Logger.Log(ex.Message);
         return(BadRequest(ErrorGeneratorMessage.Generate(ex)));
     }
     catch (Exception ex)
     {
         Logger.Log(ex.Message, "ERROR");
         return(BadRequest(ex.Message));
     }
 }