public IActionResult Index(StaffProfile p) { if (p != null) { StaffProfile profile = profileRepo.GetStaffProfileByID(p.StaffProfileID); profile.FirstName = p.FirstName; profile.LastName = p.LastName; profile.EmailNotifications = p.EmailNotifications; int verify = profileRepo.UpdateStaff(profile); if (verify == 1) { //TODO add feedback of success return(RedirectToAction("Index", "Home")); } else { //TODO add feedback for error } } else { ModelState.AddModelError("", "User Not Found"); } return(View(p)); }
public IActionResult AddKWTask(KWTaskVM vm, int?staffProfileID, string returnURL) { var kwtask = new KWTask { Message = vm.NewKWTask.Message, AlertDate = vm.NewKWTask.AlertDate, DateCreated = vm.NewKWTask.DateCreated, DateDue = vm.NewKWTask.DateDue, Priority = vm.NewKWTask.Priority }; if (kwtask.AlertDate == null) { kwtask.Type = "Task"; } else { kwtask.Type = "Alert"; } if (staffProfileID != null) { StaffProfile staff = staffRepo.GetStaffProfileByID((int)staffProfileID); staff.Tasks.Add(kwtask); } taskRepo.AddKWTask(kwtask); //TODO: See if there is a way to just close the modal and not refresh the page return(Redirect(returnURL)); }
public async Task <IActionResult> StaffDelete(int id) { StaffProfile profile = staffRepo.GetStaffProfileByID(id); if (profile != null) { StaffUser user = await userManager.FindByNameAsync(profile.Email); await userManager.DeleteAsync(user); staffRepo.DeleteStaff(profile); return(RedirectToAction("Staff")); } else { ModelState.AddModelError("", "Staff Not Found"); } return(RedirectToAction("Home")); }