コード例 #1
0
        public ActionResult Create(FormCollection collection)
        {
            try
            {
                var courseToSubmit = new Course
                {
                    CreatedByUsername = User.Identity.Name,
                    LastUpdateByUsername = User.Identity.Name,
                    CreationDate = DateTime.Now,
                    Description = collection["description"],
                    Name = collection["name"],
                    LastUpdated = DateTime.Now,
                    State = CourseState.Active,
                    NumberOfCourseCompletions = 0
                };

                CoursesModel cm = new CoursesModel();
                var savedCourse = cm.AddOrUpdateCourse(courseToSubmit);

                return RedirectToAction("Create", "CourseContents", new { id = savedCourse.Id });
            }
            catch
            {
                return View();
            }
        }
コード例 #2
0
 public CoursesService()
 {
     m_contextCoursesModel = new CoursesModel();
 }