I have two db classes one Tasks and second AssignedTasks and I want to use it in one view when the admin creates the task then he/she assigned the task parallelly in spite of first creating the view and then assigned task to employee but I didn't get how to do it as I am new in asp.net can anybody please help me through example code ? my code is as follows
public partial class Task
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
public Task()
{
this.AssignedTasks = new HashSet<AssignedTask>();
}
public int TaskId { get; set; }
public string TaskName { get; set; }
public System.DateTime TaskDeadLine { get; set; }
public int TaskNumber { get; set; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
public virtual ICollection<AssignedTask> AssignedTasks { get; set; }
}
and the code of assigned task is
public partial class AssignedTask
{
public int AssignId { get; set; }
public int AccountId { get; set; }
public int TaskId { get; set; }
public virtual Account Account { get; set; }
public virtual Task Task { get; set; }
}
The AssignedTask class has the foriegn key of task.