public string UserInfo(user model) { try { test1Entities test = new test1Entities(); user userinfo = test.user.Where(a => a.ID == model.ID).SingleOrDefault(); if (userinfo == null) { userinfo = new user(); } userinfo.USERID = model.USERID; userinfo.PASSWORD = model.PASSWORD; if (model.ID == 0) { userinfo.ISVALID = 1; test.user.Add(userinfo); } test.SaveChanges(); } catch (Exception ex) { return(getJsonResult.jsonResult(ex.Message)); } return(getJsonResult.jsonResult()); }
public string checkLogin() { string resultStr = ""; try { string userid = Request["userid"].ToString(); string password = Request["password"].ToString(); test1Entities test = new test1Entities(); user userInfo = test.user.Where(a => a.USERID == userid && a.PASSWORD == password).SingleOrDefault(); if (userInfo != null) { if (userInfo.ISVALID != 1) { resultStr = "用户已无效"; } else { Session["User"] = userInfo; } } else { resultStr = "用户不存在"; } } catch (Exception ex) { return(getJsonResult.jsonResult(ex.Message));; } return(getJsonResult.jsonResult(resultStr)); }
public ActionResult Index() { test1Entities test = new test1Entities(); List <ces> resultList = test.ces.ToList(); ViewBag.jsonStr = JsonConvert.SerializeObject(resultList); return(View()); }
public ActionResult UserInfo(int id = 0) { test1Entities test = new test1Entities(); user userinfo = new user(); if (id != 0) { userinfo = test.user.Where(a => a.ID == id).SingleOrDefault(); } return(View(userinfo)); }
public string getUserList(int pageIndex = 0, int pageSize = 10) { List <user> userList = new List <user> (); int count = 0; try { test1Entities test = new test1Entities(); userList = test.user.OrderBy(a => a.ID).ToList(); count = userList.Count; userList = userList.Skip(pageIndex * pageSize).Take(pageSize).ToList(); } catch (Exception ex) { return(getJsonResult.jsonResult(ex.Message)); } return(JsonConvert.SerializeObject(new { message = "", data = userList, count = count })); }
public string deleteUser(int id) { try { test1Entities test = new test1Entities(); user userinfo = test.user.Where(a => a.ID == id).SingleOrDefault(); if (userinfo != null) { userinfo.ISVALID = 0; } test.SaveChanges(); } catch (Exception ex) { return(getJsonResult.jsonResult(ex.Message)); } return(getJsonResult.jsonResult()); }
/// <summary> /// Constructor /// </summary> public CardnetDAL() { m_cardnetDB = new test1Entities(); // DB is now accessible }