Пример #1
0
        bool ICaseService.Complete(int caseId, int tracerId)
        {
            var completeCase = _caseRepository.GetCase(caseId);

            completeCase.Traced     = true;
            completeCase.TracedDate = DateTime.Now;
            var contacts = GetTracedContacts(caseId);

            if (contacts.Any(x => x.Email == null && x.ContactedDate == null))
            {
                return(false);
            }
            foreach (Contact contact in contacts)
            {
                var _contact = _contactRepository.GetContact(contact.ContactID);
                _contact.TracedDate = DateTime.Now;
                if (contact.Email != null)
                {
                    _emailService.ContactByEmail(contact);
                    _contact.ContactedDate = DateTime.Now;
                }
                _contactRepository.Update(_contact);
            }
            _caseRepository.Update(completeCase);
            return(true);
        }