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 }); } }
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 }); } }
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 }); } }