using System; using System.Linq; using StudyLib.API.Models; using StudyLib.Models; namespace StudyLib.API.Data { public class StudyLibDataSeeder { public static void Initialize(StudyLibContext context) { /* if (context.Subjects.Any()) { return; } context.Subjects.AddRange( new Subject { Name = "Test", LectureTeacher = "Jan Kowalski", LabTeacher = "Adam Nowak", MainExam = true, ExamDate = new DateTime(2020, 12, 10) } ); context.SaveChanges(); long addedSubjectID = context.Subjects.Where(subject => subject.Name == "Test").Select(subject => subject.ID).FirstOrDefault(); context.Assignments.Add( new Assignment { Name = "test", Deadline = new DateTime(2020, 12, 10), Description = "test", FinalMarkPercent = 100.1, SubjectId = addedSubjectID } ); context.Tests.Add( new Test { Date = new DateTime(2020, 12, 10), Scope = "Full subject", FinalMarkPercent = 100.1, SubjectId = addedSubjectID } ); context.Comments.Add( new Comment { Text = "test", SubjectId = addedSubjectID } ); context.SaveChanges();*/ } } }