public void OnApply(VacansyBLL vacnsy, SummaryBLL summary) { if (summary == null) { throw new NullSummaryException(); } if (vacnsy == null) { throw new NullVacansyException(); } Vacansy tmp = uow.RecruitersRepository.Get().Select(c => c.vacansies .FirstOrDefault(g => g.Description == vacnsy.Description && g.Purpose == vacnsy.Purpose && g.Salary == vacnsy.Salary)) .FirstOrDefault(p => p != null); if (tmp.OfferedSummarys == null) { tmp.OfferedSummarys = new List <Summary>(); tmp.OfferedSummarys.Add(CustomMapper.getSummary(summary)); } else { if (tmp.OfferedSummarys.FirstOrDefault(c => c.Name == summary.Name && c.Salary == summary.Salary && c.Info == summary.Info) != null) { throw new SameSummaryException(); } else { tmp.OfferedSummarys.Add(CustomMapper.getSummary(summary)); } } uow.Save(); }
public void UpdSummary(string user, SummaryBLL summ) { if (summ == null) { throw new NullSummaryException(); } var currUser = uow.UsersRepository.Get().FirstOrDefault(c => c.Login == user); if (currUser == null) { throw new NoSuchUserException(); } if (currUser != null) { currUser.UserSummary = CustomMapper.getSummary(summ); } uow.Save(); }
public void TestUpdSummary() { List <User> users = new List <User>(); User user1 = new User() { Login = "******" }; Summary sum1 = new Summary() { Info = "Some info" }; user1.UserSummary = sum1; users.Add(user1); mockUnitOfWork = kernel.Get <IUnitOfWork>(); IGenericRepository <User> mockUserRepository = kernel.Get <IGenericRepository <User> >(); mockUserRepository.Get().Returns(users); mockUnitOfWork.UsersRepository.Returns(mockUserRepository); editSubSys = new EditSubSystem(mockUnitOfWork); SummaryBLL expected = new SummaryBLL() { Info = "Some updated info" }; editSubSys.UpdSummary("user1", expected); SummaryBLL real = CustomMapper.getSummaryBLL(users.ElementAt(0).UserSummary); Assert.AreEqual(expected, real); }
public ICollection <VacansyBLL> OnSuggested(SummaryBLL summary) { return(CustomMapper.getVacansies(uow.VacansyRepository.Get() .Where(g => g.Purpose.Contains(summary.Position) && g.Salary >= summary.Salary)).ToList()); }
public static Summary getSummary(SummaryBLL sc) { return(iMapper.Map <Summary>(sc)); }
public void Post(string user, SummaryBLL summary) { database.updSummary(user, summary); }
public ICollection <VacansyBLL> onSuggested(SummaryBLL summary) { return(interactionSystem.OnSuggested(summary)); }
public void updSummary(string user, SummaryBLL summ) { editSystem.UpdSummary(user, summ); }
public void onApply(VacansyBLL vacnsy, SummaryBLL summary) { interactionSystem.OnApply(vacnsy, summary); }
public void Post(SummaryBLL summ, Vacansy vac) { database.onApply(CustomMapper.getVacansyBLL(vac), summ); }