public async Task<IActionResult> ChangeVisibility(TeamDto model)
        {
            try
            {
                await this._teamManager.SaveVisibility(model.Id, model.IsPublic);
                return Json(new { Status = "Success", Message = "Team Visiblity updated successfully" });
            }
            catch (Exception)
            {
                return Json(new { Status = "Error", Message = "Error updating team visibility" });
            }

        }
 public int SaveTeam(TeamDto team)
 {
     Team teamEntity = null;
     if (team.Id == 0)
     {
         teamEntity = new Team {CreatedDate = DateTime.UtcNow, Name = team.Name, CreatedByID = team.CreatedById};
         db.Teams.Add(teamEntity);
     }
     else
     {
         teamEntity = db.Teams.FirstOrDefault(s => s.ID == team.Id);
         if (teamEntity != null)
         {
             teamEntity.Name = team.Name;
             db.Entry(team).State = EntityState.Modified;
         }
     }
     db.SaveChanges();
     return teamEntity.ID;
 }
        public LoggedInSessionInfo CreateUserAccount(UserAccountDto userAccount)
        {
            var userSession = new LoggedInSessionInfo { };
            userAccount.GravatarUrl = UserService.GetGravatarHash(userAccount.EmailAddress);
            var userId = accountRepository.Save(userAccount);

            //Create a default team for the user
            var team = new TeamDto { Name = userAccount.Name.Replace(" ", "-"), CreatedById = userId };
            if (team.Name.Length > 19)
                team.Name = team.Name.Substring(0, 19);

            var teamId = teamRepository.SaveTeam(team);
            teamRepository.SaveTeamMember(teamId, userId, userId);

            teamRepository.SaveDefaultTeamForUser(userId,teamId);

            userSession.TeamId = teamId;
            userSession.UserId = userId;
            userSession.UserDisplayName = userAccount.Name;
            return userSession;
        }
Esempio n. 4
0
 public AddTeamMemberRequestVM()
 {
     this.CreatedBy = new UserDto();
     this.Team      = new TeamDto();
 }
Esempio n. 5
0
 public int SaveTeam(TeamDto team)
 {
     team.CreatedById = this._userSessionHelper.UserId;
     var teamId = _teamRepository.SaveTeam(team);
     return teamId;
 }