public async Task<IActionResult> AddAdmin(TeamTaskBoardViewModel teamTaskBoardViewModel, Guid projectId) { var userId = teamTaskBoardViewModel.NewAdminId; if (_projectRepository.AddAdmin(projectId, userId)) { _projectRepository.Save(); return RedirectToAction("Project", "Projects", new { projectId }); } TempData["ErrorMessage"] = "Admin Exist"; return RedirectToAction("Project", "Projects", new { projectId }); }
public IActionResult CreateTeam(TeamTaskBoardViewModel teamTaskBoardViewModel) { var userId = GetUserId(); var teamViewModel = teamTaskBoardViewModel.TeamViewModel; var dbTeam = _mapper.Map <DbTeam>(teamViewModel); if (_repository.CreateTeam(dbTeam, teamTaskBoardViewModel.TeamViewModel.ProjectId, userId)) { _repository.Save(); return(RedirectToAction("Project", "Projects", new { projectId = teamViewModel.ProjectId })); } TempData["ErrorMessage"] = "Team Exist"; return(RedirectToAction("Project", "Projects", new { projectId = teamTaskBoardViewModel.TeamViewModel.ProjectId })); }
public async Task<IActionResult> RemoveAdmin(TeamTaskBoardViewModel teamTaskBoardViewModel, Guid projectId) { if (_projectRepository.GetByIdSecure(projectId, GetUserId()).CreatorId .Equals(teamTaskBoardViewModel.RemoveAdminId)) { TempData["ErrorMessage"] = "You are Creator :)"; return RedirectToAction("Project", "Projects", new { projectId }); } var userId = teamTaskBoardViewModel.RemoveAdminId; if (_projectRepository.RemoveAdmin(projectId, userId)) { _projectRepository.Save(); return RedirectToAction("Project", "Projects", new { projectId }); } TempData["ErrorMessage"] = "Admin NOT Exist"; return RedirectToAction("Project", "Projects", new { projectId }); }
public IActionResult CreateTaskBoard(TeamTaskBoardViewModel teamTaskBoardViewModel, string page) { if (page == "project") { var taskBoardViewModel = teamTaskBoardViewModel.TaskBoardViewModel; var dbTaskBoard = _mapper.Map <DbTaskBoard>(taskBoardViewModel); _repository.Create(dbTaskBoard); _repository.Save(); return(RedirectToAction("Project", "Projects", new { projectId = taskBoardViewModel.ProjectId })); } else { var taskBoardViewModel = teamTaskBoardViewModel.TaskBoardViewModel; var dbTaskBoard = _mapper.Map <DbTaskBoard>(taskBoardViewModel); _repository.Create(dbTaskBoard); _repository.Save(); return(RedirectToAction("Team", "Teams", new { taskBoardViewModel.TeamId, projId = taskBoardViewModel.ProjectId })); } }