public ActionResult CreateProyectoInvestigacion([Bind(Include = "ID,nombre,medioDivulgacion")] ProyectoInvestigacion proyectoInvestigacion, HttpPostedFileBase upload, HttpPostedFileBase upload1) { try { db.ProyectoInvestigacions.Add(proyectoInvestigacion); db.SaveChanges(); PersonaXProyectoInvestigacion personaX = new PersonaXProyectoInvestigacion(); personaX.id_persona = Int32.Parse(Session["ID"].ToString()); personaX.id_proyecto_investigacion = proyectoInvestigacion.ID; db.PersonaXProyectoInvestigacions.Add(personaX); db.SaveChanges(); if (upload != null) { upload.SaveAs(Path.Combine(Server.MapPath("~/App_Data/uploads"), upload.FileName)); string fullPath = Path.Combine(Server.MapPath("~/App_Data/uploads"), upload.FileName); InsertLibroDoc(System.Guid.NewGuid(), System.IO.Path.GetFileName(upload.FileName), fullPath, 0, proyectoInvestigacion.ID); //Path.GetFullPath(upload.FileName); } if (upload1 != null) { upload1.SaveAs(Path.Combine(Server.MapPath("~/App_Data/uploads"), upload1.FileName)); string fullPath1 = Path.Combine(Server.MapPath("~/App_Data/uploads"), upload1.FileName); InsertLibroDoc(System.Guid.NewGuid(), System.IO.Path.GetFileName(upload1.FileName), fullPath1, 1, proyectoInvestigacion.ID); //Path.GetFullPath(upload.FileName); } ViewBag.proyectoInvestigacionAgregado = proyectoInvestigacion.nombre; return(View()); } catch (Exception e) { ViewBag.errorProyectoInvestigacion = "Error : No se pudo agregar " + e; return(View()); } }
public ActionResult DeleteConfirmed(int id) { ProyectoInvestigacion proyectoInvestigacion = db.ProyectoInvestigacions.Find(id); db.ProyectoInvestigacions.Remove(proyectoInvestigacion); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,nombre,medioDivulgacion")] ProyectoInvestigacion proyectoInvestigacion) { if (ModelState.IsValid) { db.Entry(proyectoInvestigacion).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(proyectoInvestigacion)); }
// GET: ProyectoInvestigacions/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProyectoInvestigacion proyectoInvestigacion = db.ProyectoInvestigacions.Find(id); if (proyectoInvestigacion == null) { return(HttpNotFound()); } return(View(proyectoInvestigacion)); }