public IActionResult AddTodo(Todo todoItem) { todoItem.UserId = User.FindFirst(ClaimTypes.NameIdentifier).Value; if (ModelState.IsValid) { _identityDBContext.Todo.Add(todoItem); _identityDBContext.SaveChanges(); } return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "id,firstname,lastname,email,password,phone")] Identity identity) { if (ModelState.IsValid) { db.Identies.Add(identity); db.SaveChanges(); return(RedirectToAction("Index", new { id = identity.id })); } return(View(identity)); }
public IActionResult EmployeeEdit(int id, EmployeeEditViewModel input) { var employee = _dbContext.Employees.Find(id); if (employee != null && ModelState.IsValid) { employee.Name = input.Name; _dbContext.SaveChanges(); return(RedirectToAction("EmployeeDetail", new { id = id })); } return(View(employee)); }