public async Task <IActionResult> AssignCareTaker(string id, AssignCareTakerModel model) { try { await this._taskService.AssignCareTakerToTask(id, model.SelectedCareTakerId); return(RedirectToAction(nameof(Tasks))); } catch { return(View()); } }
public async Task <IActionResult> AssignCareTaker(string id) { IList <User> users = await this._userManager.GetUsersInRoleAsync("CareTaker"); List <UserServiceModel> userServiceModels = new List <UserServiceModel>(); foreach (var user in users) { UserServiceModel serviceModel = new UserServiceModel { Id = user.Id, FirstName = user.FirstName, LastName = user.LastName, UserName = user.UserName }; userServiceModels.Add(serviceModel); } AssignCareTakerModel assignCareTakerModel = new AssignCareTakerModel { TaskId = id, CareTakers = userServiceModels }; return(View(assignCareTakerModel)); }