Exemple #1
0
        public LibraryViewModel(List <Book> Books, List <Tranzaction> Tranzactions)
        {
            informations = new InformationsViewModel();
            books        = new List <BookViewModel>();
            foreach (var book in Books)
            {
                var bookViewModel = new BookViewModel()
                {
                    id             = book.id,
                    title          = book.title,
                    author         = book.author,
                    numberOfCopies = book.numberOfCopies
                };

                books.Add(bookViewModel);
            }

            tranzactions = new List <Tranzaction>();
            foreach (var tranzaction in Tranzactions)
            {
                var tranzactie = new Tranzaction()
                {
                    Id     = tranzaction.Id,
                    UserId = tranzaction.UserId,
                    BookId = tranzaction.BookId
                };

                tranzactions.Add(tranzactie);
            }
        }
        public LibraryViewModel(List <Book> books1, IList <Transaction> transactions)
        {
            informations = new InformationsViewModel();
            books        = new List <BookViewModel>();
            foreach (var book in books1)
            {
                var bookViewModel = new BookViewModel()
                {
                    id         = book.id,
                    title      = book.title,
                    author     = book.author,
                    IsBorrowed = transactions.Any(t => t.Book.id == book.id)
                };

                books.Add(bookViewModel);
            }
        }
Exemple #3
0
        public LibraryViewModel(List <Book> Books)
        {
            informations = new InformationsViewModel();
            books        = new List <BookViewModel>();
            foreach (var book in Books)
            {
                var bookViewModel = new BookViewModel()
                {
                    id             = book.id,
                    title          = book.title,
                    author         = book.author,
                    numberOfCopies = book.numberOfCopies
                };

                books.Add(bookViewModel);
            }

            tranzactions = new List <Tranzaction>();
        }
Exemple #4
0
 public LibraryViewModel()
 {
     informations = new InformationsViewModel();
     books        = new List <BookViewModel>();
 }