'.NET MVC one to one relationhsip
I am designing a Room Planner and Scheduler for university classes in ASP.NET 5 using c#. Currently, I have a model for university classes and a model for Timeslots.
It should be possible to create them independent of each other without having a connection at first. It should then be possible to assign each timeslot exactly one class or each class a timeslot.
What would be the best way to implement this connection? I thought about having some kind of intermediate / junction table but I want to avoid that a class can take place in more than one classroom and vice versa.
public class SchoolClass
{
public int Id { get; set; }
public String Name { get; set; }
}
public class Timeslot
{
public int Id { get; set; }
public bool Occupied { get; set; }
public Room Room { get; set; }
public int RoomId { get; set; }
public Weekday Weekday { get; set; }
public TimeSpan Start { get; set; }
public TimeSpan End { get; set; }
}
Any help is much appreciated since I'm kinda stuck on the implementation
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
