0
도서 및 티켓 (id, borrowingDate, landingDate, idBook) - 두 개의 테이블이 있습니다. 내 DateTime 속성을 사용할 수 있는지 여부를 확인하는 방법이 필요합니다. borrowingDate가 null의 경우 -> 사용 가능한 책 내 모델 클래스가 있습니다 도서 :외래 키 테이블의 데이터에 액세스하는 방법
public class Book
{
public Book()
{
}
[Key]
public int IdBook { get; set; }
public string Title { get; set; }
[ForeignKey("Author")]
public int IdAuthor{ get; set; }
public Author Author { get; set; }
public ICollection<Ticket> Tickets { get; set; }
}
티켓 :
public class Ticket
{
public Ticket()
{
}
[Key]
public int IdTicket { get; set; }
public DateTime BorrowingDate { get; set; }
public DateTime EstimatedLandingDate { get; set; }
public DateTime? LandingTime { get; set; }
[ForeignKey("Book")]
public int IdBook { get; set; }
public Book Book { get; set; }
}
1) 우리는 코드를 작성하지 않고 주 코드를 놓치고 있습니다. 2) 티켓 클래스에 왜 당깁니다 id book이 이미 book 클래스에 있다면 전체 book 클래스와 int idBook 둘 다? 3) 특히 책 클래스를 티켓에 다시 넣는 경우에는 책 클래스의 티켓 모음을 가질 필요가 없습니다. 다른 책을 기반으로 이들 중 하나를 무한 루프로 완전히 채우기로 결정하면 특히 책 클래스를 다시 티켓에 넣을 필요가 없습니다. – Danimal