Exemplo n.º 1
0
 public async void AddUserToBoard(BoardDTO board, UserInfo user)
 {
     try
     {
         CheckToken(user.Token);
         var b = MapperBroker.GetBoardFromDTO(board);
         var u = MapperBroker.GetUserFromDTO(user.User);
         await repository.BoardInteraction.AddUserToBoardAsync(b, u);
         await CommitAndSendCallbackAsync();
     }
     catch (Exception ex)
     {
         throw ex;
     };
 }
Exemplo n.º 2
0
 public async void RemoveUserFromCard(CardDTO card, UserInfo user)
 {
     try
     {
         CheckToken(user.Token);
         var c = MapperBroker.GetCardFromDTO(card);
         var u = MapperBroker.GetUserFromDTO(user.User);
         await repository.CardManager.RemoveUserFromCardAsync(c, u);
         await CommitAndSendCallbackAsync();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
        public async Task <UserInfo> Login(UserDTO user)
        {
            try
            {
                var u = MapperBroker.GetUserFromDTO(user);
                u = await repository.UserManager.LoginAsync(u);

                var userDTO = MapperBroker.GetUserDTOFromEntity(u);
                var info    = new UserInfo {
                    User = userDTO, Token = Guid.NewGuid().ToString()
                };
                Tokens.Add(info.Token);
                return(info);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 4
0
        public async Task <bool> Register(UserDTO user)
        {
            try
            {
                var u       = MapperBroker.GetUserFromDTO(user);
                var current = OperationContext.Current;
                await repository.UserManager.RegisterAsync(u);

                lastRegistred = new KanbanSystemServiceClient {
                    ClientName = user.UserName, Callback = current.GetCallbackChannel <IServiceCallback>()
                };
                SystemServiceClients.Add(lastRegistred);
                await CommitAndSendCallbackAsync(true);

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }