public ActionResult Login(Users login) { Session["id"] = login.UserUniqueid; Session["userurl"] = login.PublicProfileUrl; Session["userfname"] = login.DisplayName; Session["userpic"] = login.PicLocation; #region /* fake data to login for testing with out a internet connnectoin Session["id"] = "szaF9K6odR"; Session["userurl"] = "http://www.linkedin.com/in/roshandhananajaya"; Session["userfname"] = "Roshan Dhananajaya"; Session["userpic"] = "its getting it from the database coz im not a new user"; */ #endregion var current = new UserDataAccess(); Users thisUser = current.GetUserInfo(Session["id"].ToString()); if (thisUser == null) { current.InsertUserInfo(login); } return Json(login); }
public ActionResult Create(Users user) { try { // Creat new user in database // todo: validate // putting new user to database with linq var userDataAccess = new UserDataAccess(); userDataAccess.InsertUserInfo(user); return Json(new { // after creating new user in database return something from here }, JsonRequestBehavior.AllowGet); } catch { // return a "Coudn't create new user" message return View(); } }