public void Update(PersonalProfileDto profile, int userId) { using (var uow = UnitOfWorkProvider.Create()) { var entity = PersonalProfileRepository.GetByUserId(userId); Mapper.Map(profile, entity); uow.Commit(); } }
public bool ProfileExists(string userName) { using (var uow = UnitOfWorkProvider.Create()) { var user = UserRepository.GetByUserName(userName); return(user != null && PersonalProfileRepository.GetByUserId(user.Id) != null); } }
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); } }
public Task <PersonalProfileEntity?> GetPersonalProfile(int userId) => _personalProfileRepo.GetByUserId(userId);