本文整理汇总了C#中Course.AddLo方法的典型用法代码示例。如果您正苦于以下问题:C# Course.AddLo方法的具体用法?C# Course.AddLo怎么用?C# Course.AddLo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Course
的用法示例。
在下文中一共展示了Course.AddLo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddLOsToCourse
public ActionResult AddLOsToCourse(Course course)
{
string stringOfLoIds = Request["selectedIds"];
if (!stringOfLoIds.IsEmpty())
{
List<string> listOfLoIds = stringOfLoIds.Split(',').ToList();
foreach (var id in listOfLoIds)
{
var id1 = id;
var lo = _dbContext.LOs.Find(x => x.Id == ObjectId.Parse(id1)).SingleAsync().Result;
if (lo != null)
{
course.Duration += lo.Duration;
course.AddLo(lo.Id);
}
}
}
ModelState.Clear();
if (course.Id != ObjectId.Empty)
{
_logger.Trace("LO or LOs added to course during course editing");
return View("EditCourse", course);
}
else
{
_logger.Trace("LO or LOs added to course during manual course creating");
return View("ManualCourseCreating", course);
}
}
示例2: AddLOsToCourse
public ActionResult AddLOsToCourse(Course course)
{
string stringOfLoIds = Request["selectedIds"];
if (!stringOfLoIds.IsEmpty())
{
List<string> listOfLoIds = stringOfLoIds.Split(',').ToList();
foreach (var id in listOfLoIds)
{
//var lo = db.GetLOByID(id);
var lo = _dbContext.LOs.Find(x => x.Id == ObjectId.Parse(id)).ToListAsync().Result;
if (lo != null)
{
course.AddLo(ObjectId.Parse(id));
}
}
}
if (course.Id != ObjectId.Empty)
{
return View("EditCourse", course);
}
else
{
return View("ManualCourseCreating", course);
}
}