public ActionResult Save(CreateAccidentRecordSummaryViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View("Index", model);
            }

            var accidentRecordId = default(long);

            try
            {
                accidentRecordId = _accidentRecordService.CreateAccidentRecord(new SaveAccidentRecordSummaryRequest
                {
                    CompanyId = CurrentUser.CompanyId,
                    UserId = CurrentUser.UserId,
                    Title = model.Title,
                    Reference = model.Reference,
                    JurisdictionId = model.JurisdictionId.Value
                });

            }
            catch (ValidationException validationException)
            {
                ModelState.AddValidationErrors(validationException);
                return View("Index", model);
            }

            return RedirectToAction("Index", "InjuredPerson", new { accidentRecordId, companyId = CurrentUser.CompanyId });
        }
 public ActionResult Index(long companyId)
 {
     var accidentRecordSummaryViewModel = new CreateAccidentRecordSummaryViewModel
     {
         CompanyId = companyId
     };
     return View("Index",accidentRecordSummaryViewModel);
 }
示例#3
0
 public void SetUp()
 {
     _accidentRecordService = new Mock<IAccidentRecordService>();
     _model = new CreateAccidentRecordSummaryViewModel
                  {
                      CompanyId = _companyId,
                      Title = "Title",
                      Reference = "Reference",
                      JurisdictionId = 1L
                  };
 }