public InventoryCompanyModel AddCompany(InventoryCompanyModel model)
 {
     model.CreatedOn = DateTime.Now;
     db.InventoryCompany.Add(model);
     db.SaveChanges();
     return(model);
 }
 public IActionResult Put(int id, [FromBody]InventoryCompanyModel value)
 {            
     try
     {
         if (!ModelState.IsValid)
         {
             return BadRequest(ModelState);
         }
         value.CompanyId = id;
         _inventoryCompanyService.UpdateCompany(value);
         responseData.Results = _inventoryCompanyService.GetCompany(id);
         responseData.Status = "OK";
     }
     catch (Exception ex)
     {
         responseData.Status = "Failed";
         responseData.ErrorMessage = ex.Message + " exception details:" + ex.ToString();
     }
     return Ok(responseData);
 }
 public IActionResult Post([FromBody]InventoryCompanyModel value)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return BadRequest(ModelState);
         }
         RbacUser currentUser = HttpContext.Session.Get<RbacUser>("currentuser");
         value.CreatedBy = currentUser.EmployeeId;
         _inventoryCompanyService.AddCompany(value);
         responseData.Results = _inventoryCompanyService.GetCompany(value.CompanyId);
         responseData.Status = "OK";
     }
     catch (Exception ex)
     {
         responseData.Status = "Failed";
         responseData.ErrorMessage = ex.Message + " exception details:" + ex.ToString();
     }
     return Ok(responseData);
 }
 public InventoryCompanyModel UpdateCompany(InventoryCompanyModel model)
 {
     db.Entry(model).State = System.Data.Entity.EntityState.Modified;
     db.SaveChanges();
     return(model);
 }