public IActionResult Edit(Employee employee) { if (ModelState.IsValid) { _employeeRepository.Update(employee); return RedirectToAction("Index"); } return View("Edit", employee); }
public IActionResult Create(Employee employee) { if (ModelState.IsValid) { _employeeRepository.Save(employee); return RedirectToAction("Index"); } return View("Create", employee); }
public async Task Update(Employee employee) { _employeeContext.Employees.Update(employee); await _employeeContext.SaveChangesAsync(); }
public async Task Delete(Employee employee) { _employeeContext.Employees.Remove(employee); await _employeeContext.SaveChangesAsync(); }
public async Task Save(Employee employee) { _employeeContext.Employees.Add(employee); await _employeeContext.SaveChangesAsync(); }