public async Task <IActionResult> Edit(int id, string returnUrl = null)
        {
            if (String.IsNullOrEmpty(returnUrl))
            {
                returnUrl = Request.Headers["Referer"].ToString();
            }

            var visitState = await _visitStateRepo.GetVisitState(id);

            VisitStateViewModel visitStateVM = VisitStateViewModelFactory.Edit(visitState, returnUrl);

            return(View("Edit", visitStateVM));
        }
        public async Task <IActionResult> Edit([FromForm] VisitStateViewModel visitStateVM)
        {
            if (ModelState.IsValid)
            {
                await _visitStateRepo.UpdateVisitState(visitStateVM.VisitState);

                TempData["message"]     = "Your data has been updated successfully.";
                TempData["toasterType"] = ToasterType.success;

                return(RedirectToAction(nameof(Edit), new { id = visitStateVM.VisitState.Id, returnUrl = visitStateVM.ReturnUrl }));
            }
            else
            {
                TempData["message"]     = "A problem has been ocurred while updating your data.";
                TempData["toasterType"] = ToasterType.info;
            }

            return(View("Edit", VisitStateViewModelFactory.Edit(visitStateVM.VisitState, visitStateVM.ReturnUrl)));
        }