public BookLoanModel Insert(BookLoanModel bookLoanModel) { BookLoanEntity bookLoanEntity = _mapper.Map <BookLoanEntity>(bookLoanModel); bookLoanEntity.KeyId = Guid.NewGuid( ); bookLoanEntity.BookId = _bookBusiness.GetIdBookByKeyId(bookLoanModel.BookKeyId); bookLoanEntity.ReaderId = _readerBusiness.GetIdBookByKeyId(bookLoanModel.ReaderKeyId); bookLoanEntity.ReturnDate = null; bookLoanEntity.ReturnFeedback = null; bookLoanEntity = _repository.Insert(bookLoanEntity); BookLoanModel bookLoan = _mapper.Map <BookLoanModel>(bookLoanEntity); bookLoan.BookKeyId = bookLoanModel.BookKeyId; bookLoan.ReaderKeyId = bookLoanModel.ReaderKeyId; return(bookLoan); }