Ejemplo n.º 1
0
        public ActionResult AspNetUserPartialUpdate(Models.Database.AspNetUser item)
        {
            var model = dbAspNetUser.AspNetUsers;

            if (ModelState.IsValid)
            {
                try
                {
                    var modelItem = model.FirstOrDefault(it => it.Id == item.Id);
                    if (modelItem != null)
                    {
                        UpdateModel(modelItem);
                        dbAspNetUser.SaveChanges();
                    }
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_AspNetUserPartial", AspNetUser.GetUserModel()));
        }
Ejemplo n.º 2
0
        public ActionResult AspNetUserPartialDelete(String id)
        {
            var model = dbAspNetUser.AspNetUsers;

            if (id != null)
            {
                try
                {
                    var item = model.FirstOrDefault(it => it.Id == id);
                    if (item != null)
                    {
                        model.Remove(item);
                    }
                    dbAspNetUser.SaveChanges();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            return(PartialView("_AspNetUserPartial", AspNetUser.GetUserModel()));
        }
Ejemplo n.º 3
0
        public ActionResult AspNetUserPartialAddNew(Models.Database.AspNetUser item)
        {
            var model = dbAspNetUser.AspNetUsers;

            if (ModelState.IsValid)
            {
                try
                {
                    item.UserParentId = new Guid(MySession.Current.UserGuid);
                    item.Id           = Guid.NewGuid().ToString();
                    model.Add(item);
                    dbAspNetUser.SaveChanges();
                }
                catch (Exception e)
                {
                    ViewData["EditError"] = e.Message;
                }
            }
            else
            {
                ViewData["EditError"] = "Please, correct all errors.";
            }
            return(PartialView("_AspNetUserPartial", AspNetUser.GetUserModel()));
        }
Ejemplo n.º 4
0
 public ActionResult AspNetUserPartial()
 {
     return(PartialView("_AspNetUserPartial", AspNetUser.GetUserModel()));
 }