public async Task<ActionResult> Redigera(Employee employee) { if (ModelState.IsValid) { db.Entry(employee).State = EntityState.Modified; await db.SaveChangesAsync(); return RedirectToAction("Index"); } return View(employee); }
public async Task<ActionResult> Skapa(Employee employee) { if (ModelState.IsValid) { employee.CreatedOn = DateTime.Now; db.Employees.Add(await employee.AssignValuesAsync(db)); await db.SaveChangesAsync(); return RedirectToAction("Index"); } return View(employee); }