public IHttpActionResult Modify([FromBody] SYS_Company item) { var app = _unityContainer.Resolve <ICompanyManagementService>(); SYS_CompanyDTO newItem = null; try { newItem = app.ModifyCompany(item); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok(newItem)); }
public IHttpActionResult Add([FromBody] SYS_Company item) { var claims = Helper.GetClaims(User.Identity as ClaimsIdentity); int workSpaceId = Convert.ToInt32(claims["WorkSpaceId"]); SYS_CompanyDTO newItem = null; var app = _unityContainer.Resolve <ICompanyManagementService>(); item.WorkSpaceId = workSpaceId; item.UserRegistration = claims[ClaimTypes.Name]; item.RegistrationDate = DateTime.UtcNow; try { newItem = app.AddCompany(item, claims[ClaimTypes.Name]); } catch (Exception ex) { return(BadRequest(ex.Message)); } return(Ok(newItem)); }