public async Task <ActionResult> EditFeatureValueEU(Guid tenderguId, string featureId, int featureValueId) { var featureValue = await DraftProvider.GetDraftFeatureValue(tenderguId, featureValueId); var viewModel = new FeatureValueEUViewModel(tenderguId, featureValue); return(View(viewModel)); }
public ActionResult AddFeatureValueEU(Guid tenderGuid, string featureId) { var viewModel = new FeatureValueEUViewModel { TenderGuid = tenderGuid, FeatureStringId = featureId }; return(View(viewModel)); }
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 })); }
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 })); }