Ejemplo n.º 1
0
        public async Task <ActionResult> Perpetrator(PerpetratorViewModel viewModel, bool hasVictim)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }
            var report = await GetCurrentReport();

            _modelFactory.Modify(report, viewModel);
            await _reportProxy.PatchAsync(report.Id, report);

            return(RedirectToAction(hasVictim ? "Victim" : "Vehicle"));
        }
Ejemplo n.º 2
0
 public void Modify(Report report, PerpetratorViewModel viewModel)
 {
     if (report.Perpetrator == null)
     {
         report.Perpetrator = new Perpetrator();
     }
     if (viewModel.AgeRange != null)
     {
         var values     = viewModel.AgeRange.Split('-');
         var minimumAge = Convert.ToInt32(values[0]);
         var maximumAge = Convert.ToInt32(values[1]);
         report.Perpetrator.MinimumAge = minimumAge;
         report.Perpetrator.MaximumAge = maximumAge;
     }
     report.Perpetrator.Name             = viewModel.Name;
     report.Perpetrator.Clothing         = viewModel.Clothing;
     report.Perpetrator.Sex              = viewModel.Sex;
     report.Perpetrator.SkinColor        = viewModel.SkinColor;
     report.Perpetrator.UniqueProperties = viewModel.UniqueProperties;
 }
Ejemplo n.º 3
0
 public void Modify(Report report, PerpetratorViewModel viewModel)
 {
     if (report.Perpetrator == null)
     {
         report.Perpetrator = new Perpetrator();
     }
     if (viewModel.AgeRange != null)
     {
         var values = viewModel.AgeRange.Split('-');
         var minimumAge = Convert.ToInt32(values[0]);
         var maximumAge = Convert.ToInt32(values[1]);
         report.Perpetrator.MinimumAge = minimumAge;
         report.Perpetrator.MaximumAge = maximumAge;
     }
     report.Perpetrator.Name = viewModel.Name;
     report.Perpetrator.Clothing = viewModel.Clothing;
     report.Perpetrator.Sex = viewModel.Sex;
     report.Perpetrator.SkinColor = viewModel.SkinColor;
     report.Perpetrator.UniqueProperties = viewModel.UniqueProperties;
 }
Ejemplo n.º 4
0
        public async Task<ActionResult> Perpetrator(PerpetratorViewModel viewModel, bool? hasVictim)
        {
            var victim = hasVictim.HasValue && hasVictim.Value;

            if (!ModelState.IsValid)
            {
                return View(viewModel);
            }
            var report = new Report();
            _modelFactory.Modify(report, viewModel);
            await _reportProxy.PatchAsync(GetCurrentReportId(), report);

            return RedirectToAction(victim ? "Victim" : "Vehicle");
        }