コード例 #1
0
        public async Task <ActionResult> EditFeatureValueEU(FeatureValueEUViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            await DraftProvider.EditDraftFeatureValue(viewModel.TenderGuid, viewModel.ToDTO());

            return(RedirectToAction("Info", "DraftTenderInfo", new { tenderGuid = viewModel.TenderGuid }));
        }
コード例 #2
0
        public async Task <ActionResult> AddFeatureValueEU(FeatureValueEUViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            var featureValuesPresent =
                await DraftProvider.GetDraftFeatureValues(viewModel.TenderGuid, viewModel.FeatureStringId);

            var featureValuesSum = featureValuesPresent.Sum(m => m.Value);

            if (viewModel.Value + featureValuesSum > 0.3)
            {
                ModelState.AddModelError(nameof(viewModel.Value), GlobalRes.MaximumNonPriceCriteriaMessage);
                return(View(viewModel));
            }
            var draftFeatureValueDTO = viewModel.ToDTO();
            await
            DraftProvider.AddDraftFeatureValue(viewModel.TenderGuid, viewModel.FeatureStringId, draftFeatureValueDTO);

            return(RedirectToAction("Info", "DraftTenderInfo", new { tenderGuid = viewModel.TenderGuid }));
        }