public async Task <IActionResult> AddTask(BoardAddTaskViewModel model) { if (!ModelState.IsValid) { return(View(model)); } var story = await _storyService.GetByIdAsync(int.Parse(model.StoryId)); var user = await _userManager.Users.FirstOrDefaultAsync(x => x.Id == model.UserId); var Task = new ScrumApplicationData.Models.Tasks { Story = story, ApplicationUser = user, Name = model.Name, Description = model.Description, Day = model.Day, TaskStatusId = model.TaskStatusId, UserId = model.UserId }; await _storyService.AddTask(Task); return(RedirectToAction(nameof(Index), new { story.Id })); }