public CountryVM_DataManager()
 {
     countryVM                = new CountryVM();
     countryVM.country        = new Country();
     countryVM.countries      = getCountries();
     countryVM.BusinessErrors = new List <ModelStateDictionary>();
 }
 public void SaveCountry(CountryVM countryVM)
 {
     using (aspnetCoreAuthenticationBE4FE1DC128845159E4A1B6F524F8DF7Context _aspnetCoreAuthenticationBE4FE1DC128845159E4A1B6F524F8DF7Context = new aspnetCoreAuthenticationBE4FE1DC128845159E4A1B6F524F8DF7Context())
     {
         _aspnetCoreAuthenticationBE4FE1DC128845159E4A1B6F524F8DF7Context.Country.Add(new Country()
         {
             Id = Guid.NewGuid().ToString(), Name = countryVM.country.Name
         });
         _aspnetCoreAuthenticationBE4FE1DC128845159E4A1B6F524F8DF7Context.SaveChanges();
     }
 }
        public static ModelStateDictionary ValidateCountry(ref CountryVM countryVM)
        {
            ModelStateDictionary keyValues = new ModelStateDictionary();

            if (countryVM.country.Name == "aa")
            {
                keyValues.AddModelError("country.Name", "invalid country name aa");
                countryVM.BusinessErrors.Add(keyValues);
            }

            return(keyValues);
        }