本文整理汇总了C#中Course.Validate方法的典型用法代码示例。如果您正苦于以下问题:C# Course.Validate方法的具体用法?C# Course.Validate怎么用?C# Course.Validate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course.Validate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteCourse
/// <summary>
/// Deletes the specified <see cref="Course" />.
/// </summary>
/// <param name="course">The course.</param>
/// <returns>
/// Total number of records affected. This may aggregate counts from <see cref="Chapter" /> and <see cref="Slide" /> members.
/// </returns>
/// <exception cref="Neddle.NeddleException">
/// </exception>
public int DeleteCourse(Course course)
{
// TODO: KLC add option here to allow preservation of slides, e.g. for reuse in other courses
Contract.Requires<ArgumentNullException>(course != null);
Logger.DebugFormat(Resources.Courses.CourseDelete, course.Id);
course.Validate();
Exists(course, true);
int affected = _dataProvider.Delete(course);
if (affected == 0)
{
throw new NeddleException(Resources.Courses.CourseCouldNotBeDeleted, course.Id);
}
return affected;
}
示例2: SaveCourse
/// <summary>
/// Save the course.
/// </summary>
/// <param name="course">The course.</param>
/// <returns>A reference to the updated course entity.</returns>
public Course SaveCourse(Course course)
{
Contract.Requires<ArgumentNullException>(course != null);
Logger.DebugFormat(Resources.Courses.CourseLoad, course.Id);
course.Validate();
return _dataProvider.Save(course);
}