public List <User> getUserByUserName(string username) { MemberShip member = new MemberShip(); List <User> userlist = new List <User>(); User user = null; var q = from c in db.User where c.name.Contains(username) select c; foreach (var a in q) { user = new User(); user.userid = a.userid; user.tip = a.tip; user.phone = a.phone; user.paypassword = a.paypassword; user.password = a.password; user.name = a.name; user.instruction = a.instruction; user.image = a.image; userlist.Add(user); } return(userlist); }
public List <Blog> getBlogByUsername(string username) { MemberShip member = new MemberShip(); List <Blog> bloglist = new List <Blog>(); Blog blog = null; int userid = member.getUserIdByName(username); var q = from c in db.Blog where c.userid == userid select c; foreach (var a in q) { blog = new Blog(); blog.userid = a.userid; blog.blogid = a.blogid; blog.category = a.category; blog.content = a.content; blog.title = a.title; blog.updatetime = a.updatetime; blog.userid = a.userid; blog.costnum = a.costnum; bloglist.Add(blog); } return(bloglist); }