示例#1
0
 public IActionResult AddTodo(Todo todoItem)
 {
     todoItem.UserId = User.FindFirst(ClaimTypes.NameIdentifier).Value;
     if (ModelState.IsValid)
     {
         _identityDBContext.Todo.Add(todoItem);
         _identityDBContext.SaveChanges();
     }
     return(RedirectToAction("Index"));
 }
示例#2
0
        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));
        }
示例#3
0
        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));
        }