Пример #1
0
        public void UpdateZone(Zone zone)
        {
            List <ValidationResult> errors = new List <ValidationResult>();
            bool valid = Validator.TryValidateObject(zone, new ValidationContext(zone), errors, true);

            if (valid)
            {
                context.Entry(zone).State = EntityState.Modified;
                context.SaveChanges();
            }
        }
Пример #2
0
        public ActionResult EditAdmin(string id, ApplicationUser user)
        {
            try
            {
                PolitiekeBarometerContext dbContext = new PolitiekeBarometerContext();

                dbContext.Entry(user).State = EntityState.Modified;
                dbContext.SaveChanges();

                return(RedirectToAction("LijstAdmins"));
            }
            catch
            {
                return(View());
            }
        }
Пример #3
0
        public ActionResult EditUser(string id, ApplicationUser user)
        {
            try
            {
                PolitiekeBarometerContext dbContext       = new PolitiekeBarometerContext();
                IPlatformManager          platformManager = new PlatformManager();

                dbContext.Entry(user).State = EntityState.Modified;
                dbContext.SaveChanges();

                var gebruiker = platformManager.getGebruiker(user.Id);
                gebruiker.Naam  = user.Name;
                gebruiker.Email = user.Email;
                platformManager.updateGebruiker(gebruiker);

                return(RedirectToAction("LijstUsers"));
            }
            catch
            {
                return(View());
            }
        }
 public void saveGebruiker(Gebruiker gebruiker)
 {
     context.Entry(gebruiker).State = EntityState.Modified;
     context.SaveChanges();
 }
 public void setElement(Element element)
 {
     context.Entry(element).State = EntityState.Modified;
     context.SaveChanges();
 }