public User Login(User user) { var username = user.Name; var password = user.Password; var filter = filterBuilder.Where(x => x.Name == username && x.Password == password); var result = dbService.Query(filter).Result; if (result.Count > 0) { return result[0]; } else { return new User(); } }
public User DeleteUser(User user) { var filter = filterBuilder.Where(x => x.ID == user.ID); user = dbService.Query(filter).Result[0]; user.UpDateTime = DateTime.Now; user.ValidStatus = 0; var result = dbService.Update(filter, user).Result; if (result.IsModifiedCountAvailable && result.ModifiedCount == 1) { return dbService.Query(filter).Result[0]; } else { return new User(); } }
public User RegisterUser(User user) { user.ID = Guid.NewGuid().ToString(); user.CreateTime = DateTime.Now; user.UpDateTime = DateTime.Now; user.ValidStatus = (int) ValidStatus.TRUE; dbService.Add(user); return GetUser(user.ID); }