Beispiel #1
0
        public ActionResult GetCourseFromXmlFile(HttpPostedFileBase xmlFile)
        {
            if (XmlValidator.IsXmlFile(xmlFile))
            {
                var courseModel = this.xmlProcessor.GetCourseModelFromXml(xmlFile.FileName);

                this.repository.CreateCourseFromCourseModel(courseModel);

                if (!courseModel.IsDone)
                {
                    var addLessonsViewModel = new AddLessonsViewModel()
                    {
                        CourseModel = courseModel
                    };

                    return(this.View("AddLessonsToCourse", addLessonsViewModel));
                }

                return(this.RedirectToAction("Index", "Home"));
            }

            return(this.View("Error"));
        }