public String Register(FormCollection fd) { var user = new User(); TryUpdateModel<User>(user,fd); if (baseServiceU.Exist(p=>p.UserName==user.UserName)) { return "0"; } user.AddTime = DateTime.UtcNow; user.UpdateTime = DateTime.UtcNow; baseServiceU.Add(user); return "1"; }
public String Login(FormCollection fd) { var user = new User(); TryUpdateModel<User>(user, fd); if (baseServiceU.Exist(p => p.UserName == user.UserName && p.UserPassword == user.UserPassword)) { Session["user"] = baseServiceU.Find(p => p.UserName == user.UserName); return "1"; } else { return "0"; } }