public void Update(PersonalProfileDto profile, int userId) { using (var uow = UnitOfWorkProvider.Create()) { var entity = PersonalProfileRepository.GetByUserId(userId); Mapper.Map(profile, entity); uow.Commit(); } }
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(); } }