public string Register(User model) { string strResultado = "ok"; try { storeDB.Users.Add(model); storeDB.SaveChanges(); } catch (Exception ex) { strResultado = "Error al registrar" + ex.Message; } // If we got this far, something failed, redisplay form return strResultado; }
public JsonResult VerificaLogeo() { User objUser = new User(); if (Session["userId"] == null) { objUser = null; } else { objUser = storeDB.Users.AsEnumerable() .Where(w => w.User_id == Convert.ToInt32(Session["userId"])) .Select(s =>new User() { User_id = s.User_id, UserName = s.UserName, Email = s.Email, Password = s.Password }).SingleOrDefault(); } return Json(objUser); }