コード例 #1
0
        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();
        }
コード例 #2
0
        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();
        }