コード例 #1
0
 public Lease(int Id, DateTime start, DateTime expectedReturm, DateTime actualReturn, User user, Copy copy,
     Fine fine)
 {
     this.Id = Id;
     this.StartDate = start;
     this.ExpectedReturn = expectedReturm;
     this.ActualReturn = actualReturn;
     this.User = user;
     this.Copy = copy;
     this.Fine = fine;
 }
        private BookCopyViewModel MapBookCopyToViewModel(Copy bookCopy)
        {
            var bookViewModel = new BookCopyViewModel
            {
                Id = bookCopy.Id,
                BookId = bookCopy.Book.Id,
                Available = bookCopy.Available,
            };

            if (bookCopy.Publication != null)
            {
                bookViewModel.ISBN = bookCopy.Publication.ISBN ?? String.Empty;
                bookViewModel.Publisher = bookCopy.Publication.Publisher ?? String.Empty;
                bookViewModel.Year = bookCopy.Publication.Year;
            }
            else
            {
                bookViewModel.ISBN = String.Empty;
                bookViewModel.Publisher = String.Empty;
            }

            return bookViewModel;
        }