public ActionResult Edit(Company company) { if (ModelState.IsValid) { db.Entry(company).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(company); }
public ActionResult Create(Company company) { if (ModelState.IsValid) { db.Companies.Add(company); db.SaveChanges(); return RedirectToAction("Index"); } return View(company); }
public void SetDataFromCompany(Company c, LunchArea area) { this.Name = c.Name; this.Adress = c.Adress; this.Company = c; this.Email = c.Email; this.Information = c.Information; this.Url = c.Url; if (!Areas.Any(a => a.Id == area.Id)) { this.Areas.Add(area); } }