public RetrieveResult <NonWildfireAssessmentMitigationRequirementsViewModel> RetrieveView(DataSourceRequest request, Guid mitigationRequirementsId)
        {
            var dbSet = context.Set <InspectionOrderPropertyNonWildfireAssessmentMitigationRequirements>()
                        .Include(a => a.Image)
                        .Where(a => a.InspectionOrderPropertyNonWildfireAssessmentMitigation.Id == mitigationRequirementsId)
                        .OrderBy(a => a.Image.CreatedAt);

            var resultList = Retrieve(dbSet, request);

            var mitigationList = new RetrieveResult <NonWildfireAssessmentMitigationRequirementsViewModel>();

            mitigationList.PageNo       = resultList.PageNo;
            mitigationList.SortBy       = resultList.SortBy;
            mitigationList.RecordPage   = resultList.RecordPage;
            mitigationList.TotalRecords = resultList.TotalRecords;
            mitigationList.Results      = resultList.Results.Select(mitigation => new NonWildfireAssessmentMitigationRequirementsViewModel
            {
                InspectionOrderPropertyNonWildfireAssessmentMitigationId = mitigation.InspectionOrderPropertyNonWildfireAssessmentMitigationId,
                InspectionOrderPropertyNonWildfireAssessmentMitigation   = mitigation.InspectionOrderPropertyNonWildfireAssessmentMitigation,
                Id                   = mitigation.Id,
                Description          = mitigation.Description,
                ImageId              = mitigation.ImageId,
                Image                = mitigation.Image,
                ChildMitigation      = mitigation.ChildMitigation,
                ChildMitigationCount = _inspectionOrderNonWildfireAssessmentChildMitigationRequirementsRepository.childMitigationCount(mitigation.Id),
                Status               = mitigation.Status
            }).ToList();

            return(mitigationList);
        }
Esempio n. 2
0
 //[Authorize(Policy = PolicyNames.Anyone)]
 public IActionResult RetrieveNonWildfireAssessmentChildMitigationRequirements(Guid parentMitigationId)
 {
     return(Ok(_inspectionOrderPropertyNonWildfireAssessmentChildMitigationRequirementsRepository.childMitigationCount(parentMitigationId)));
 }