public OperationResult <bool> Delete(int id)
        {
            var technologyMaps = _requirementTechnologyMapRepository.GetAllBy(m => m.RequirementId == id);

            foreach (var map in technologyMaps)
            {
                _requirementTechnologyMapRepository.Delete(map);
            }

            var activities = _requirementActivityRepository.GetAllBy(m => m.RequirementId == id);

            foreach (var activity in activities)
            {
                _requirementActivityRepository.Delete(activity);
            }

            var docs = _requirementDocumentRepository.GetAllBy(m => m.RequirementId == id);

            foreach (var doc in docs)
            {
                _requirementDocumentRepository.Delete(doc);
            }

            _requirementRepository.Delete(id);
            _unitOfWork.Commit();

            return(new OperationResult <bool> {
                Status = true
            });
        }
Exemple #2
0
        public ActionResult Details(int id)
        {
            var requirement  = _requirementRepository.GetBy(r => r.Id == id, "Contact.Person,AssignedToUser.Person,CreatedByUser.Person");
            var technologies = _requirementTechnologyMapRepository.GetAllBy(m => m.RequirementId == requirement.Id, "Technology").Select(m => m.Technology).ToList();
            var docs         = _requirementDocumentRepository.GetAllBy(d => d.RequirementId == requirement.Id);
            var vm           = new RequirementDetailsViewModel(requirement)
            {
                RequirementDocuments = docs.ToList(),
                Technologies         = technologies
            };

            return(View(vm));
        }