public ActionResult DeleteConfirmed(int id)
        {
            DocumentoModels documentoModels = db.DocumentoModels.Find(id);

            db.DocumentoModels.Remove(documentoModels);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "DocumentoId,NombreDocumento,Materia,CalificacionDocumento,CalidadDocumento,FechaDocumento,FechaCreacion,PaisID,IdiomaID,UniversidadID,ApplicationUserID,Descripcion,Link")] DocumentoModels documentoModels)
 {
     if (ModelState.IsValid)
     {
         db.Entry(documentoModels).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.IdiomaID      = new SelectList(db.IdiomaModels, "IdiomaID", "Nombre", documentoModels.IdiomaID);
     ViewBag.PaisID        = new SelectList(db.PaisModels, "PaisID", "Nombre", documentoModels.PaisID);
     ViewBag.UniversidadID = new SelectList(db.UniversidadModels, "UniversidadID", "Nombre", documentoModels.UniversidadID);
     return(View(documentoModels));
 }
        // GET: Documento/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DocumentoModels documentoModels = db.DocumentoModels.Find(id);

            if (documentoModels == null)
            {
                return(HttpNotFound());
            }
            return(View(documentoModels));
        }
        // GET: Documento/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DocumentoModels documentoModels = db.DocumentoModels.Find(id);

            if (documentoModels == null)
            {
                return(HttpNotFound());
            }
            ViewBag.IdiomaID      = new SelectList(db.IdiomaModels, "IdiomaID", "Nombre", documentoModels.IdiomaID);
            ViewBag.PaisID        = new SelectList(db.PaisModels, "PaisID", "Nombre", documentoModels.PaisID);
            ViewBag.UniversidadID = new SelectList(db.UniversidadModels, "UniversidadID", "Nombre", documentoModels.UniversidadID);
            return(View(documentoModels));
        }
        public ActionResult Create([Bind(Include = "DocumentoId,NombreDocumento,Materia,CalificacionDocumento,CalidadDocumento,FechaDocumento,FechaCreacion,PaisID,IdiomaID,UniversidadID,ApplicationUserID,Descripcion,Link")] DocumentoModels documentoModels)
        {
            if (ModelState.IsValid)
            {
                if (User.Identity.IsAuthenticated)
                {
                    documentoModels.ApplicationUserID = (Guid)Membership.GetUser().ProviderUserKey;
                }
                documentoModels.FechaCreacion = DateTime.Now;

                db.DocumentoModels.Add(documentoModels);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.IdiomaID      = new SelectList(db.IdiomaModels, "IdiomaID", "Nombre", documentoModels.IdiomaID);
            ViewBag.PaisID        = new SelectList(db.PaisModels, "PaisID", "Nombre", documentoModels.PaisID);
            ViewBag.UniversidadID = new SelectList(db.UniversidadModels, "UniversidadID", "Nombre", documentoModels.UniversidadID);
            return(View(documentoModels));
        }