Exemplo n.º 1
0
 public ActionResult Edit(UserProfile userprofile)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userprofile).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(userprofile);
 }
Exemplo n.º 2
0
        public ActionResult Create(UserProfile userprofile)
        {
            if (ModelState.IsValid)
            {
                db.UserProfiles.Add(userprofile);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(userprofile);
        }
Exemplo n.º 3
0
        public ActionResult Edit(UserRole userprofile,string role)
        {
            try
            {
                UserProfile userprofile1 = new UserProfile();
                userprofile1.UserId = userprofile.userid;
                userprofile1.UserName = userprofile.userName;
                List<webpages_Roles> collect = new List<webpages_Roles>();
                collect.Add(db.webpages_Roles.Find(int.Parse(role)));
                userprofile1.webpages_Roles = collect as ICollection<webpages_Roles>;
                List<ModelState> asdf = ModelState.Values.ToList();

                db.Entry(userprofile1).State = EntityState.Modified;
                db.SaveChanges();
                return RedirectToAction("Index");
            }
            catch (Exception ex)
            {
                ViewBag.Error = ex.Message;
                return View(userprofile);
            }
        }