Example #1
0
        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
            });
        }
        public ActionResult DeleteConfirmed(int id)
        {
            var requirementDocument = _requirementDocumentRepository.Get(id);

            _requirementDocumentRepository.Delete(id);
            _unitOfWork.Commit();
            return(RedirectToAction("Details", "Requirements", new { id = requirementDocument.RequirementId }));
        }