Esempio n. 1
0
        internal static bool UpdateCountry(StaffyloContext context, Country country)
        {
            bool    countryUpdated  = false;
            Country countryToUpdate = context.Countries.Where(c => c.Code == country.Code).FirstOrDefault();

            if (countryToUpdate != null)
            {
                countryToUpdate.Name = country.Name;
                context.Update(countryToUpdate);
                context.SaveChanges();
                countryUpdated = true;
            }

            return(countryUpdated);
        }