Пример #1
0
 public SemesterDto Remove(SemesterDto semesterDto)
 {
     using (var db = new AbetContext())
     {
         var result = db.Semesters.Remove(new Semester {
             Id = semesterDto.Id, Name = semesterDto.Name
         });
         db.SaveChanges();
         return(new SemesterDto {
             Id = result.Id, Name = result.Name
         });
     }
 }
Пример #2
0
 public ReviewDto Remove(ReviewDto reviewDto)
 {
     using (var db = new AbetContext())
     {
         var result = db.Reviews.Remove(new Review
         {
             Id         = reviewDto.Id,
             Rating     = reviewDto.Rating,
             ClassId    = reviewDto.ClassId,
             ReviewText = reviewDto.ReviewText
         });
         db.SaveChanges();
         return(new ReviewDto
         {
             Id = result.Id,
             Rating = reviewDto.Rating,
             ClassId = reviewDto.ClassId,
             ReviewText = reviewDto.ReviewText
         });
     }
 }
Пример #3
0
 public async Task <ClassDto> Remove(ClassDto classDto)
 {
     using (var db = new AbetContext())
     {
         var result = db.Classes.Remove(new Class
         {
             Id         = classDto.Id,
             SemesterId = classDto.SemesterId,
             CourseCode = classDto.CourseCode,
             CourseName = classDto.CourseName,
             Instructor = classDto.Instructor
         });
         db.SaveChanges();
         return(new ClassDto {
             Id = result.Id,
             SemesterId = result.SemesterId,
             CourseCode = result.CourseCode,
             CourseName = result.CourseName,
             Instructor = result.Instructor
         });
     }
 }