public async Task <List <TaskStatusBasicModel> > GetTeamTaskStatuses([FromBody] UserTeamModel teamModel) { LoginUserViewModel details = new LoginUserViewModel { Email = teamModel.UserLogin, Password = teamModel.Password }; bool succeeded = await _userService.LoginAsync(details); if (succeeded) { USER user = await _userRepository.GetUserByEmail(details.Email); if (_teamRepository.IsTeamMember(user, teamModel.TeamId)) { var taskStatuses = _taskService.GetTaskStatusesForTeam(teamModel.TeamId); if (taskStatuses != null && taskStatuses.TaskStatuses != null) { List <TaskStatusBasicModel> taskStatusesReturnModel = new List <TaskStatusBasicModel>(); foreach (var status in taskStatuses.TaskStatuses) { TaskStatusBasicModel taskStatus = new TaskStatusBasicModel { StatusId = status.StatusId, StatusName = status.StatusName }; taskStatusesReturnModel.Add(taskStatus); } return(taskStatusesReturnModel); } } } return(null); }
public IActionResult Create(UserTeamModel item) { using (MySqlConnection connection = new MySqlConnection(defaultConnection)) { IEnumerable <UserTeamModel> output = connection.Query <UserTeamModel>("INSERT INTO UserTeam (teamID, userID) VALUES ((@_teamID), (@_userID))", new { _teamID = item.teamID, _userID = item.userID }); return(NoContent()); } }
public static UserTeam MapUserTeamModelToUserTeamEntity(UserTeamModel model) { return(new UserTeam { TeamId = model.TeamId, Team = MapTeamModelToTeamEntityBase(model.Team), UserId = model.UserId, User = MapUserModelToUserEntityBase(model.User) }); }
public async Task <List <TasksWithStatusModel> > GetTasks([FromBody] UserTeamModel teamModel) { LoginUserViewModel details = new LoginUserViewModel { Email = teamModel.UserLogin, Password = teamModel.Password }; bool succeeded = await _userService.LoginAsync(details); if (succeeded) { USER user = await _userRepository.GetUserByEmail(details.Email); if (_teamRepository.IsTeamMember(user, teamModel.TeamId)) { var model = _taskService.TaskList(teamModel.TeamId, user); if (model.TasksByStatus != null) { List <TasksWithStatusModel> retModel = new List <TasksWithStatusModel>(); foreach (var taskByStatus in model.TasksByStatus) { TasksWithStatusModel tasksWithStatus = new TasksWithStatusModel { TaskStatusId = taskByStatus.TaskStatusId, TaskStatusName = taskByStatus.TaskStatusName, Tasks = taskByStatus.Tasks.Select(x => new TaskModel { TaskId = x.ID, TaskDescription = x.DESCRIPTION, TaskTitle = x.TITLE, Deathline = x.DEATHLINE.ToString(), StartTime = x.START_TIME.ToString(), EndTime = x.END_TIME.ToString() }).ToList() }; retModel.Add(tasksWithStatus); } return(retModel); } } } return(null); }
public async Task <List <MemberViewModel> > GetMembers([FromBody] UserTeamModel teamModel) { LoginUserViewModel details = new LoginUserViewModel { Email = teamModel.UserLogin, Password = teamModel.Password }; bool succeeded = await _userService.LoginAsync(details); if (succeeded) { USER user = await _userRepository.GetUserByEmail(details.Email); if (_teamRepository.IsTeamMember(user, teamModel.TeamId)) { TeamMemberViewModel model = _teamService.GetTeamMembers(teamModel.TeamId); return(model.Members); } } return(null); }