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

            var report = await GetCurrentReport();

            if (viewModel.HasVehicle)
            {
                _modelFactory.Modify(report, viewModel);
                await _reportProxy.PatchAsync(report.Id, report);
            }

            switch (report.Category)
            {
            case "Theft":
            case "Nuisance":
            case "Other":
                return(RedirectToAction("ContactRequired"));

            default:
                return(RedirectToAction("Contact"));
            }
        }
コード例 #2
0
 public void Modify(Report report, VehicleViewModel viewModel)
 {
     report.Vehicle = new Vehicle
     {
         Brand              = viewModel.Brand,
         Color              = viewModel.Color,
         NumberPlate        = viewModel.NumberPlate,
         AdditionalFeatures = viewModel.AdditionalFeatures
     };
 }
コード例 #3
0
ファイル: ModelFactory.cs プロジェクト: AndreasFurster/kiwi
 public void Modify(Report report, VehicleViewModel viewModel)
 {
     report.Vehicle = new Vehicle
     {
         Brand = viewModel.Brand,
         Color = viewModel.Color,
         NumberPlate = viewModel.NumberPlate,
         AdditionalFeatures = viewModel.AdditionalFeatures,
         VehicleType = viewModel.VehicleType
     };
 }
コード例 #4
0
        public async Task<ActionResult> Vehicle(VehicleViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return View(viewModel);
            }

            var report = new Report();

            if (viewModel.HasVehicle)
            {
                _modelFactory.Modify(report, viewModel);
                report = await _reportProxy.PatchAsync(GetCurrentReportId(), report);
            }
            else
            {
                report = await GetCurrentReport();
            }

            switch (report.Category)
            {
                case "Theft":
                case "Nuisance":
                case "Other":
                    return RedirectToAction("ContactRequired");

                default:
                    return RedirectToAction("Contact");
            }
        }