예제 #1
0
        public IGroupOfStudents Register(IGroupOfStudents groupOfStudents)
        {
            _context.GroupOfStudents.Add((GroupOfStudents)groupOfStudents);

            _context.SaveChanges();

            foreach (var studentId in groupOfStudents.StudentsIds)
            {
                var student = _context.Students.Single(s => s.Id == studentId);
                student.GroupOfStudentId = groupOfStudents.Id;
                student.PaymentTypeId    = groupOfStudents.PaymentTypeId;
                student.IsVIP            = groupOfStudents.IsVIP;
                student.PaymentDate      = DateTime.Today.AddDays(new PaymentTypes().GetPaymentType(groupOfStudents.PaymentTypeId).DaysToPay);

                new Student().Update(student);
            }

            return(groupOfStudents);
        }
예제 #2
0
 public bool Delete(IGroupOfStudents groupOfStudents)
 {
     _context.GroupOfStudents.Remove((GroupOfStudents)groupOfStudents);
     return(true);
 }