Exemplo n.º 1
0
 public void Create(Report report, EditDoneViewModel viewModel)
 {
     viewModel.Category = report.Category;
     viewModel.Description = report.Description;
     viewModel.DrugsAction = report.DrugsAction;
     viewModel.FighterCount = report.FighterCount;
     viewModel.IsUnconscious = report.IsUnconscious;
     viewModel.DateOfTheft = report.DateOfTheft;
     viewModel.StolenObject = report.StolenObject;
     viewModel.Victim = report.Victim;
     viewModel.VictimName = report.VictimName;
     viewModel.IsWeaponPresent = report.IsWeaponPresent;
     viewModel.WeaponLocation = report.WeaponLocation;
     viewModel.WeaponType = report.WeaponType;
     viewModel.Location = report.Location;
     viewModel.Perpetrator = report.Perpetrator;
     viewModel.Vehicle = report.Vehicle;
     viewModel.Contact = report.Contact;
 }
Exemplo n.º 2
0
        public async Task<ActionResult> EditDone(EditDoneViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return View(viewModel);
            }
            var report = await GetCurrentReport();
            _modelFactory.Modify(report, viewModel);
            await _reportProxy.PatchAsync(report.Id, report);

            // TODO: add error handling
            return RedirectToAction("Done");
        }
Exemplo n.º 3
0
        public void Modify(Report report, EditDoneViewModel viewModel)
        {
            report.Category = viewModel.Category;
            report.Description = viewModel.Description;
            report.DrugsAction = viewModel.DrugsAction;
            report.FighterCount = viewModel.FighterCount;
            report.IsUnconscious = viewModel.IsUnconscious;
            report.DateOfTheft = viewModel.DateOfTheft;
            report.StolenObject = viewModel.StolenObject;
            report.Victim = viewModel.Victim;
            report.VictimName = viewModel.VictimName;
            report.IsWeaponPresent = viewModel.IsWeaponPresent;
            report.WeaponLocation = viewModel.WeaponLocation;
            report.WeaponType = viewModel.WeaponType;
            if(viewModel.WeaponType == "Anders")
            {
                report.WeaponType = viewModel.OtherType;
            }
            report.Location = viewModel.Location;
            report.Perpetrator = viewModel.Perpetrator;
            report.Vehicle = viewModel.Vehicle;

            if (viewModel.Contact.Name != null || viewModel.Contact.PhoneNumber != null || viewModel.Contact.EmailAddress != null)
            {
                if (report.Contact == null)
                {
                    report.Contact = new Contact();
                }
                report.Contact = viewModel.Contact;
            }
            else
            {
                report.Contact = null;
            }
        }
Exemplo n.º 4
0
 public async Task<ActionResult> EditDone()
 {
     var viewModel = new EditDoneViewModel();
     var report = await GetCurrentReport();
     _modelFactory.Create(report, viewModel);
     return View(viewModel);
 }