public IActionResult Create(String returnUrl) { if (String.IsNullOrEmpty(returnUrl)) { returnUrl = Request.Headers["Referer"].ToString(); } return(View("Edit", VisitStateViewModelFactory.Create(new VisitStateDto(), returnUrl))); }
public async Task <IActionResult> Create([FromForm] VisitStateViewModel visitStateVM) { if (ModelState.IsValid) { var newVisitState = await _visitStateRepo.AddVisitState(visitStateVM.VisitState); TempData["message"] = "Your data has been submitted successfully."; TempData["toasterType"] = ToasterType.success; //return RedirectToAction(nameof(Index)); return(RedirectToAction(nameof(Edit), new { id = newVisitState.Id, returnUrl = visitStateVM.ReturnUrl })); } TempData["message"] = "A problem has been ocurred while submitting your data."; TempData["toasterType"] = ToasterType.info; return(View("Edit", VisitStateViewModelFactory.Create(visitStateVM.VisitState, visitStateVM.ReturnUrl))); }