public NotificationNumberViewModelTests() { model = new NotificationNumberViewModel { NotificationNumber = AnyNotificationNumber }; }
public async Task WithoutNotificationNumber_NotValid() { NotificationNumberViewModel model = new NotificationNumberViewModel(); controller.ModelState.AddModelError("test", "test"); var result = await controller.Number(model) as ViewResult; Assert.False(controller.ModelState.IsValid); Assert.Equal(string.Empty, result.ViewName); }
public async Task<ActionResult> Number(NotificationNumberViewModel model) { if (!ModelState.IsValid) { return View(model); } if (!await mediator.SendAsync(new CheckImportNumberUnique(model.NotificationNumber))) { ModelState.AddModelError("NotificationNumber", "A record for this notification number already exists"); return View(model); } TempData[ImportNotificationNumber] = model.NotificationNumber; return RedirectToAction("ReceivedDate"); }
public async Task <ActionResult> Number(NotificationNumberViewModel model) { if (!ModelState.IsValid) { return(View(model)); } if (!await mediator.SendAsync(new CheckImportNumberUnique(model.NotificationNumber))) { ModelState.AddModelError("NotificationNumber", "A record for this notification number already exists"); return(View(model)); } TempData[ImportNotificationNumber] = model.NotificationNumber; return(RedirectToAction("ReceivedDate")); }