public bool AddMoney(int accId, decimal sum) { string message = ""; List <Account> accounts = db.GetCollection <Account>(); Account facc = accounts.Where(w => w.Id == accId).FirstOrDefault(); if (facc != null) { facc.Balance += sum; } return(db.UpDate <Account>(facc, out message)); }
public User GetUser(string login, string password) { string message = ""; User user = IsExist(login); if (user != null) { if (user.password != password) { if (user.wrongpasswordscount == 3) { user.status = 2;//заблокирован } user.wrongpasswordscount = user.wrongpasswordscount + 1; db.UpDate <User>(user, out message); } else if (user.password == password) { return(user); } } return(null); //List<User> users = db.GetCollection<User>(); //return users // .Where(w => w.login == login && w.password == password) // .FirstOrDefault(); }