public bool TryGet(int id, out ordinaryuser user) { user = db.ordinaryuser.Find(id); if (user != null) { return(true); } else { return(false); } }
public bool UpdateStu(int id, ordinaryuser user) { var result = db.ordinaryuser.Where(s => s.ID == id).FirstOrDefault <ordinaryuser>(); if (result != null) { result.IDCard = user.IDCard; result.PhoneNumber = user.PhoneNumber; result.Pwd = user.Pwd; result.RealName = user.RealName; db.SaveChanges(); return(true); } else { return(false); } }
public ordinaryuser AddStu(ordinaryuser user) { user = db.ordinaryuser.Add(user); db.SaveChanges(); return(user); }