Esempio n. 1
0
        public ActionResult Edit(ApplicationUser model)
        {
            try
            {
                NguoiDungModels nd = new NguoiDungModels();


                context.Entry(model).State = System.Data.Entity.EntityState.Modified;
                context.SaveChanges();
                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View(model));
            }
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(string Id)
        {
            ApplicationUser model = null;

            try
            {
                model = context.Users.Find(Id);
                context.Users.Remove(model);
                context.SaveChanges();

                NguoiDungModels nguoiDungModels = db.nguoiDungModels.Find(Id);
                db.nguoiDungModels.Remove(nguoiDungModels);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("", ex.Message);
                return(View("Delete", model));
            }
        }