Esempio n. 1
0
        public PartialViewResult BulkRowFieldVisits(BulkRowFieldVisitViewModel viewModel)
        {
            var fieldVisits = new List <FieldVisit>();

            if (viewModel.EntityIDList != null)
            {
                fieldVisits = HttpRequestStorage.DatabaseEntities.FieldVisits.Where(x => viewModel.EntityIDList.Contains(x.FieldVisitID)).OrderBy(x => x.TreatmentBMP.TreatmentBMPName).ToList();
            }
            ModelState.Clear(); // we intentionally want to clear any error messages here since this post route is returning a view
            var viewData = new BulkRowFieldVisitViewData(fieldVisits, SitkaRoute <BulkRowController> .BuildUrlFromExpression(x => x.MarkFieldVistsVerifiedModal(null)), "Field Visit", "The selected Field Visits will be marked as Verified until the Field Visit is updated or a Jurisdiction Manager later flags the data as provisional.");

            return(RazorPartialView <BulkRowFieldVisit, BulkRowFieldVisitViewData, BulkRowFieldVisitViewModel>(viewData, viewModel));
        }
Esempio n. 2
0
        public ActionResult MarkFieldVistsVerifiedModal(BulkRowFieldVisitViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(new ModalDialogFormJsonResult());
            }

            var fieldVisits = HttpRequestStorage.DatabaseEntities.FieldVisits.Where(x => viewModel.EntityIDList.Contains(x.FieldVisitID)).ToList();

            fieldVisits.ForEach(x => x.VerifyFieldVisit(CurrentPerson));
            SetMessageForDisplay($"{fieldVisits.Count} Field Visits were successfully verified.");
            return(new ModalDialogFormJsonResult());
        }