public ActionResult RemoveStaff(StaffRemoveViewModel model) { var userId = model.UserId; var user = _context.Staff.FirstOrDefault(x => x.UserId == userId); user.LeaveDate = DateTime.Now; user.CurrentlyEmployed = false; _context.Staff.Update(user); _context.SaveChanges(); return(RedirectToAction("Remove")); }
public ActionResult Remove() { var model = new StaffRemoveViewModel() { Users = _context.ApplicationUsers .Where(x => x.Staff != null) .Select(x => new SelectListItem() { Text = x.Email, Value = x.Id.ToString() }) .ToList(), }; return(View(model)); }