1

I am creating a simple application where users can log notifications

For the Create View where a user logs a Notification I want the user to fill in the details of the Notification and then also have an input section to add multiple GeneratingJobs for the notification (a Many-to-Many relationship) and then when the user submits the notification, the Notification gets logged along with the GeneratingJobs in a many-to-many relationship.

Entity Relationship

  • Notification (*Many) <---> (*Many) GeneratingJob
  • Notification (*Many) <---> (1One) Reporter

enter image description here

Can anyone help?

In my model I have:


Notification Class (contains details about the Notification, such as Description, DateSubmitted etc)

public class Notification
{
    public int ID { get; set; }

    public string Title { get; set; }

    public string Description_of_Symptoms { get; set; }

    public string Additional_Information { get; set; }

    public DateTime Submitted_Date { get; set; }

    public int Occurrences { get; set; }

    public string ReporterWindowsIdentity { get; set; }

    public virtual Reporter Reporter { get; set; }
    public virtual ICollection<GeneratingJob> GeneratingJobs { get; set; }

}

Reporter Class (contains information about the user logging the Notification)

public class Reporter
{
    [Key]
    public string WindowsIdentity { get; set; }

    public string Firstname { get; set; }
    public string Surname { get; set; }

    public virtual ICollection<Notification> Notifications { get; set; }
}

GeneratingJob Class (contains information about the Job that generated the Notification)

public class GeneratingJob
{

    public int Id { get; set; }
    public string Title { get; set; }
    public string Description { get; set; }
    public int GeneratingJobPriorityId { get; set; }

    public virtual ICollection<Notification> Notifications { get; set; }
    public virtual GeneratingJobPriority GeneratingJobPriority { get; set; }
}

GeneratingJobPriority Class (contains information about the Job that generated the Notification's priority)

public class GeneratingJobPriority
{
    public int Id { get; set; }
    public string Priority { get; set; }

    public virtual ICollection<GeneratingJob> GeneratingJobs { get; set; }
}
  • Seems to complicated, maybe you should rethink and simplify your model ... for example Notifications in GeneratingJob and Reporter do not have to be a relation, they can be retrieved using a query on notifications ... – Bogdan Apr 27 '14 at 20:10
  • To get you started, here (http://stackoverflow.com/a/16383982/270591) is an example how you would add preexisting GeneratingJobs by selecting check boxes. A full answer is a too huge topic for a single question in my opinion. It would probably be better if you break your question down into smaller questions along with more details what you already have or have tried. – Slauma Apr 27 '14 at 21:32

0 Answers0