public void Registration(string name, string login, string password) { User user = users.Find(value => value.Login == login); if (user == null) { User newUser = new User() { Name = name, Login = login, Password = password }; usersFactoryRepository.AddItem(newUser); } else { Console.WriteLine("You are already a user"); } }
public void BorrowBook(Book book, string login) { int counter = 0; foreach (Shelve shelve in shelves) { List <string> books = shelve.BooksOnShelve; if (books != null && books.Any(value => value == book.ISBN)) { foreach (string _isbn in shelve.BooksOnShelve) { if (book.ISBN == _isbn) { shelve.BooksOnShelve.Remove(_isbn); var cou = borrowings.Count; Borrowing newBorrowing = new Borrowing() { Id = cou + 1, Login = login, ISBN = _isbn, TakingDt = DateTime.Now }; borrowingFactoryRepository.AddItem(newBorrowing); booksOnShelvesFactoryRepository.SaveData(); counter++; break; } } if (counter == 0) { Console.WriteLine("There are no such book with this isbn"); } } } }