public IEnumerable <Artist> GetUserArtists(string username, string password)
        {
            var login = _userLoginRepository.Get(username);

            if (login == null)
            {
                throw new UserDoesNotExistException(username);
            }
            if (login.Password != password.Encrypt())
            {
                throw new InvalidPasswordException(username);
            }
            return(login.Artists);
        }
        public async Task <IList <UserLoginInfo> > GetLoginsAsync(ApplicationUser user, CancellationToken cancellationToken)
        {
            cancellationToken.ThrowIfCancellationRequested();

            var userLoginsDto = await _userLoginRepository.Get(user.Id);

            var userLoginInfoList = userLoginsDto.Select(t => new UserLoginInfo(t.LoginProvider, t.ProviderKey, t.ProviderDisplayName)).ToList();

            return(userLoginInfoList);
        }
Beispiel #3
0
        public ActionResult SelectArtist(string returnUrl)
        {
            ViewBag.ReturnUrl = returnUrl;
            var artists = _userLoginRepository.Get(User.Identity.Name).Artists;

            return(View(_mapper.Map <IEnumerable <ArtistViewModel> >(artists).Select(model => new SelectListItem()
            {
                Text = model.Name,
                Value = model.Id.ToString()
            })));
        }
Beispiel #4
0
        public void Handle(AddNewArtist command)
        {
            var user = _userLoginRepository.Get(command.Creator);

            if (user == null)
            {
                throw new InvalidOperationException("Username is invalid");
            }
            var artist = Artist.Create(command.Name);

            user.AddArtist(artist);
            DomainEvents.Raise(new ArtistWasAdded()
            {
                Artist = artist
            });
        }
 /// <summary>
 /// Kullanıcının login entitysini getirir.
 /// </summary>
 /// <param name="userId"></param>
 /// <returns></returns>
 public async Task <DtoUserLogins> GetLoginEntity(int userId)
 {
     return(await _mapper.Map <Task <DtoUserLogins> >(_userLoginRepository.Get(x => x.UserId == userId)));
 }
 public void Handle(AddConnectionIdToUserCommand command)
 {
     _userLoginRepository.Get(command.Username).ConnectWithSignalR(command.ConnectionId);
 }