public bool RemoveCourse(CourseTO courseTo) { if (courseTo is null) { throw new ArgumentNullException(nameof(courseTo)); } if (courseTo.Id == 0) { throw new Exception("Course does not exist"); } try { iRSUnitOfWork.CourseRepository.Remove(courseTo.ToDomain().ToTransfertObject()); return(true); } catch (Exception) { throw; } }
public bool UpdateCourse(CourseTO courseTo) { if (courseTo is null) { throw new ArgumentNullException(nameof(courseTo)); } if (courseTo.Id == 0) { throw new Exception("Course does not exist"); } courseTo.Name.IsNullOrWhiteSpace("Missing Course Name"); try { iRSUnitOfWork.CourseRepository.Update(courseTo.ToDomain().ToTransfertObject()); return(true); } catch (Exception) { throw; } }
public bool AddCourse(CourseTO courseTo) { if (courseTo is null) { throw new ArgumentNullException(nameof(courseTo)); } if (courseTo.Id != 0) { throw new Exception("Existing Course"); } courseTo.Name.IsNullOrWhiteSpace("Missing course name"); try { iRSUnitOfWork.CourseRepository.Add(courseTo.ToDomain().ToTransfertObject()); return(true); } catch (Exception) { throw; } }