public void Save(CountryViewModel country)
        {
            Country coutr = new Country(country.id)
            {
                Name = country.Name,
                Code = country.Code,
                Currency = country.Currency
            };
            _countryRepository.Save(coutr);

        }
Example #2
0
 public ActionResult EditCountry(CountryViewModel cvm)
 {
     try
     {
         _countryViewModelBuilder.Save(cvm);
         return RedirectToAction("ListCountry");
     }
     catch (DomainValidationException dve)
     {
         ValidationSummary.DomainValidationErrors(dve, ModelState);
         return View();
     }
     catch (Exception ex)
     {
         ViewBag.msg = ex.Message;
         return View();
     }
 }
Example #3
0
 public ActionResult CreateCountry(CountryViewModel cvm)
 {
     try
     {
         cvm.id = Guid.NewGuid();
         _countryViewModelBuilder.Save(cvm);
         TempData["msg"] = "Country Successfully Created";
         return RedirectToAction("ListCountry");
     }
     catch (DomainValidationException dve)
     {
         ValidationSummary.DomainValidationErrors(dve, ModelState);
         _log.Debug("Failed to create country" + dve.Message);
         _log.Error("Failed to create country" + dve.ToString());
         return View();
     }
     catch (Exception ex)
     {
         ViewBag.msg = ex.Message;
         _log.Debug("Failed to create country" + ex.Message);
         _log.Error("Failed to create country" + ex.ToString());
         return View();
     }
 }