public ActionResult Edit(Employee employee) { if (ModelState.IsValid) { this.employeeRepository.InsertOrUpdate(employee); this.employeeRepository.Save(); return RedirectToAction("Index"); } return this.View(); }
public void InsertOrUpdate(Employee employee) { if (employee.ID == default(int)) { this.context.Employees.Add(employee); } else { this.context.Entry(employee).State = EntityState.Modified; } }
public ActionResult Create(Employee employee) { var client = new HttpClient(); client.GetAsync("www.dcsdcds.dcs"); logger.Trace("Request made"); if (ModelState.IsValid) { this.employeeRepository.InsertOrUpdate(employee); this.employeeRepository.Save(); return RedirectToAction("Index"); } return this.View(); }