// POST: Company?tenant_id public void Post(string tenant_id, [FromBody] Company Company) { //ID = AutoIncrement & Owner = tenant_id. Company.Owner = tenant_id; CompanyService.Add(Company); CompanyService.Commit(); }
public ActionResult Create([Bind(Include = "CompanyID,CompanyName,Address,PhoneNumber,Country")] Company Company) { if (ModelState.IsValid) { Company.Owner = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/tenantid").Value; CompanyService.Add(Company); CompanyService.Commit(); return(RedirectToAction("Index")); } return(View(Company)); }
public ActionResult Create(companyViewModel company) { try { // TODO: Add insert logic here company c = new company(); c.Website = company.Website; c.Name = company.Name; c.Country = company.Country; // c.Id = 1; service.Add(c); service.Commit(); return(RedirectToAction("Index")); } catch { return(View()); } }