// GET: Materias
        public ActionResult Evaluaciones()
        {
            var process  = new Web.Business.Repository();
            var materias = process.GetAsignaturas();

            return(View(materias));
        }
        public ActionResult Search(string searchString)
        {
            var searchStr = Request.Form["SearchString"];

            if (searchString.Length > 0)
            {
                var process  = new Web.Business.Repository();
                var materias = process.GetAsignaturas(searchString);

                return(View("Evaluaciones", materias));
            }
            else
            {
                return(View("Evaluaciones"));
            }
        }
        // GET: Evaluacion/Edit/5
        public ActionResult Edit(decimal?id)
        {
            if (id == null && id > 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var process     = new Web.Business.Repository();
            var objToUpdate = process.GetAsignatura(id.Value);

            if (objToUpdate == null)
            {
                return(HttpNotFound());
            }
            return(View(objToUpdate));
        }
        public ActionResult Save(decimal?id, FormCollection collection)
        {
            try
            {
                if (id == null && id > 0)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                var    tareas     = Request.Form["NotaTareas"];
                var    examen     = Request.Form["NotaExamen"];
                double notaTarea  = 0;
                double notaExamen = 0;

                double.TryParse(tareas, out notaTarea);
                double.TryParse(examen, out notaExamen);

                var asignatura = new Asignatura()
                {
                    ID         = id.Value,
                    NotaExamen = notaExamen,
                    NotaTareas = notaTarea
                };

                var process    = new Web.Business.Repository();
                var objUpdated = process.SaveAsignatura(asignatura);
                if (objUpdated)
                {
                    return(RedirectToAction("Evaluaciones"));
                }
                return(RedirectToAction("Evaluaciones"));
            }
            catch
            {     //Log the error (uncomment dex variable name and add a line here to write a log.
                ModelState.AddModelError("", "Unable to save changes. Try again, and if the problem persists, see your system administrator.");
                return(RedirectToAction("Evaluaciones"));
            }
        }