예제 #1
0
 public void SetProperties(StudentProperties properties)
 {
     FirstName = properties.FirstName ?? FirstName;
     LastName  = properties.LastName ?? LastName;
     Age       = properties.Age ?? Age;
     if (properties.StudentCourse != null)
     {
         StudentCourses = properties.StudentCourse.Value.Select(x => new StudentCourse()
         {
             Course = x.Course
         }).ToList();
     }
 }
예제 #2
0
        static void Main(string[] args)
        {
            var context = new MyDbContext(@"data source=(LocalDb)\MSSQLLocalDB;initial catalog=EFTest;integrated security=True;");

            using (var rep = new StudentRepository(context)) {
                var ser    = new StudentService(rep);
                var proper = new StudentProperties()
                {
                    //FirstName = "Oleksandr",
                    //LastName = "Klymchuk",
                    //Age = 31,
                    StudentCourse = new List <StudentCourseProperties>()
                    {
                        new StudentCourseProperties()
                        {
                            Course = 5
                        },
                        //new StudentCourseProperties() { Course=2}
                    }
                };
                var d = ser.Get(2);
                ser.Update(2, proper);
            }
        }
예제 #3
0
 public void Update(int studentId, StudentProperties properties)
 {
     repository.Update(studentId, properties);
 }
예제 #4
0
 public void Add(StudentProperties properties)
 {
     repository.Add(properties);
 }