コード例 #1
0
        public Boolean returnBook(LoanDTO loanDto)
        {
            Loan loan = context.Loan.Find(loanDto.Id);

            loan.Returned_date = DateTime.Now;
            context.SaveChanges();
            if (loan.Returned_date > loan.Return_date)
            {
                MessageBox.Show("Książka zwrócona po terminie zwrotu!", "Zwrot książki",
                                MessageBoxButton.OK, MessageBoxImage.Error);
            }
            return(true);
        }
コード例 #2
0
        public static LoanDTO createDto(Loan loan)
        {
            LoanDTO dto = new LoanDTO();

            dto.Id            = loan.Id;
            dto.Loan_date     = loan.Loan_date;
            dto.Return_date   = loan.Return_date;
            dto.Returned_date = loan.Returned_date;
            dto.User          = loan.User.Name + " " + loan.User.Surname;
            dto.Book          = loan.Book.Id + " " + loan.Book.Title;
            dto.Admin         = loan.Admin.Name + " " + loan.Admin.Surname;

            return(dto);
        }