示例#1
0
 public ActionResult Edit(User user)
 {
     try
     {
         if (ModelState.IsValid)
         {
             db.Entry(user).State = EntityState.Modified;
             db.SaveChanges();
             return RedirectToAction("Index");
         }
     }
     catch(DataException)
     {
         ModelState.AddModelError("","Unable to save any changes. Try again.");
     }
     return View(user);
 }
示例#2
0
 public ActionResult Create(User user)
 {
     try
     {
         if (ModelState.IsValid)
         {
             user.Id = Guid.NewGuid();
             db.Users.Add(user);
             db.SaveChanges();
             return RedirectToAction("Index");
         }
     }
     catch(DataException)
     {
         ModelState.AddModelError("","Unable to save any changes made. Try again.");
     }
     return View(user);
 }
示例#3
0
        public JsonResult FacebookLogin(User model)
        {
            Session["uid"] = model.Id;
            Session["accessToken"] = model.accessToken;

            return Json(new { success = true });
        }