public PersonalProfileDto GetById(int id) { using (UnitOfWorkProvider.Create()) { var entity = PersonalProfileRepository.GetById(id); return(Mapper.Map <PersonalProfileDto>(entity)); } }
public GetPersonalProfileDependencies(PersonalProfileRepository personalProfileRepo, SkillRepository skillRepo, InterestsRepository interestsRepository, UserIdRepository userIdRepository) { _personalProfileRepo = personalProfileRepo; _skillRepo = skillRepo; _interestsRepository = interestsRepository; _userIdRepository = userIdRepository; }
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 PostPersonalProfileDependencies(PersonalProfileRepository personalProfileRepo, SkillRepository skillRepo, InterestsRepository interestsRepository, UserIdRepository userIdRepository, IEmailSender emailSender) { _personalProfileRepo = personalProfileRepo; _skillRepo = skillRepo; _interestsRepository = interestsRepository; _userIdRepository = userIdRepository; _emailSender = emailSender; }
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 void Insert(PersonalProfileDto profile, string userName) { using (var uow = UnitOfWorkProvider.Create()) { var user = UserRepository.GetByUserName(userName); if (user == null) { throw new UIException("Neexistuje meno užívateľa, profil sa nedá uložiť"); } var entity = PersonalProfileRepository.InitializeNew(); Mapper.Map(profile, entity); entity.User = user; PersonalProfileRepository.Insert(entity); uow.Commit(); } }