Exemplo n.º 1
0
 public void Update(PersonalProfileDto profile, int userId)
 {
     using (var uow = UnitOfWorkProvider.Create())
     {
         var entity = PersonalProfileRepository.GetByUserId(userId);
         Mapper.Map(profile, entity);
         uow.Commit();
     }
 }
Exemplo n.º 2
0
        public bool ProfileExists(string userName)
        {
            using (var uow = UnitOfWorkProvider.Create())
            {
                var user = UserRepository.GetByUserName(userName);

                return(user != null && PersonalProfileRepository.GetByUserId(user.Id) != null);
            }
        }
Exemplo n.º 3
0
        public void Remove(int userId)
        {
            using (var uow = UnitOfWorkProvider.Create())
            {
                if (UserRepository.GetById(userId) == null)
                {
                    throw new UIException("Neexistuje Id užívateľa, profil sa nedá zmazať");
                }

                var profile = PersonalProfileRepository.GetByUserId(userId);

                if (UserRepository.GetById(userId) == null)
                {
                    throw new UIException("Nenašiel sa profil, nedá sa zmazať");
                }

                PersonalProfileRepository.Delete(profile);
            }
        }
Exemplo n.º 4
0
 public Task <PersonalProfileEntity?> GetPersonalProfile(int userId)
 => _personalProfileRepo.GetByUserId(userId);