public ActionResult Edit(CountryViewModel model)
 {
     if (ModelState.IsValid)
     {
         var dbItem = _countryManager.GetById(model.Id);
         if (dbItem == null)
         {
             throw new NullReferenceException();
         }
         dbItem = _countryFieldCopier.CopyFields(model, dbItem);
         _countryManager.Edit(dbItem);
         return(RedirectToAction("List"));
     }
     return(View(model));
 }
        public async Task <ActionResult> Edit(CountryVM model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            OperationResult result = await _countryManager.Edit(new CountryDTO
            {
                Id   = model.Id,
                Name = model.Name
            });

            if (result.Type == ResultType.Success)
            {
                //_toast.AddSuccessToastMessage("Country has been successfully edited");
                //return View(model);
                return(RedirectToAction(nameof(List)));
            }

            ModelState.AddModelError(nameof(model.Name), result.BuildMessage());

            return(View(model));
        }