示例#1
0
 public T ReadList <T>(int id) where T : class
 {
     if (typeof(T) == typeof(Models.Project))
     {
         return(Project.SingleOrDefault(u => u.ProjectId == id) as T);
     }
     else if (typeof(T) == typeof(Models.Backlog))
     {
         return(Backlog.SingleOrDefault(u => u.BacklogId == id) as T);
     }
     else if (typeof(T) == typeof(Models.Sprint))
     {
         return(Sprint.SingleOrDefault(u => u.SprintId == id) as T);
     }
     if (typeof(T) == typeof(Models.Step))
     {
         return(Step.SingleOrDefault(u => u.StepId == id) as T);
     }
     else if (typeof(T) == typeof(Models.Task))
     {
         return(Task.SingleOrDefault(u => u.TaskId == id) as T);
     }
     else if (typeof(T) == typeof(Models.User))
     {
         return(User.SingleOrDefault(u => u.UserId == id) as T);
     }
     else
     {
         return(default(T));
     }
 }