public ActionResult Create()
 {
     var teacherId = GetTeacherId();
     var detalleAnhosAcademicosActivos = _academicYearDetailRepository.GetAllAcademicYearDetails().ToList().FindAll(x => x.AcademicYear.IsActive);
     var detallesFilteredByTeacher = detalleAnhosAcademicosActivos.FindAll(x => x.Teacher.Id == teacherId);
     var query = detallesFilteredByTeacher.Select(detail => detail.Course).ToList();
     ViewBag.course = new SelectList(query, "Id", "Name");
     var modelRegister = new CreateHomeworkModel();
     return View(modelRegister);
 }
        public ActionResult Create(CreateHomeworkModel modelHomework)
        {
            var myHomework = new Homework
            {
                Title = modelHomework.Title,
                Description = modelHomework.Description,
                DeliverDate = ParseToHonduranDateTime.Parse(modelHomework.DeliverDate),
                Points = modelHomework.Points,
                AcademicYearDetail = _academicYearDetailRepository.FindByCourse(_courseRepository.GetById(modelHomework.Course).Id,GetTeacherId())
            };

            _homeworkRepository.Create(myHomework);
            const string title = "Tarea agregada";
            string content = "La tarea " + myHomework.Title + " ha sido agregado exitosamente.";
            _viewMessageLogic.SetNewMessage(title, content, ViewMessageType.SuccessMessage);
            return RedirectToAction("Index");
        }