public ActionResult DeleteConfirmed(int id) { DesarrolloSoftware desarrolloSoftware = db.DesarrolloSoftwares.Find(id); db.DesarrolloSoftwares.Remove(desarrolloSoftware); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,nombre,numeroAutores")] DesarrolloSoftware desarrolloSoftware) { if (ModelState.IsValid) { db.Entry(desarrolloSoftware).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(desarrolloSoftware)); }
public ActionResult CreateDesarrolloSoftware([Bind(Include = "ID,nombre,numeroAutores, autores, autorXDesarrolloSoftware")] DesarolloSoftwareAutor desarrolloSoftwareAutor, HttpPostedFileBase upload) { try { DesarrolloSoftware software = new DesarrolloSoftware(); software.nombre = desarrolloSoftwareAutor.nombre; software.numeroAutores = desarrolloSoftwareAutor.numeroAutores; db.DesarrolloSoftwares.Add(software); db.SaveChanges(); PersonaXDesarrolloSoftware personaSoftware = new PersonaXDesarrolloSoftware(); personaSoftware.id_persona = Int32.Parse(Session["ID"].ToString()); personaSoftware.id_desarrollo_software = software.ID; db.PersonaXDesarrolloSoftwares.Add(personaSoftware); db.SaveChanges(); for (int i = 0; i < desarrolloSoftwareAutor.numeroAutores; i++) { Autor autor = new Autor(); autor.nombre = desarrolloSoftwareAutor.autores[i].nombre; autor.correoElectronico = desarrolloSoftwareAutor.autores[i].correoElectronico; db.Autors.Add(autor); db.SaveChanges(); AutorXDesarrolloSoftware autorXdesarrollo = new AutorXDesarrolloSoftware(); autorXdesarrollo.id_desarrollo_software = software.ID; autorXdesarrollo.id_autor = autor.ID; autorXdesarrollo.distribucionAutoria = Convert.ToDecimal(desarrolloSoftwareAutor.autorXDesarrolloSoftware.ElementAt(i).distribucionAutoria); db.AutorXDesarrolloSoftwares.Add(autorXdesarrollo); 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); InsertDesarrolloSoftwareDoc(System.Guid.NewGuid(), System.IO.Path.GetFileName(upload.FileName), fullPath, 0, software.ID); } ViewBag.softAgregado = desarrolloSoftwareAutor.nombre; return(View()); } catch (DbEntityValidationException dbEx) { foreach (var validationErrors in dbEx.EntityValidationErrors) { foreach (var validationError in validationErrors.ValidationErrors) { ViewBag.errorsoft = "Error: " + dbEx; Trace.TraceInformation("Property: {0} Error: {1}", validationError.PropertyName, validationError.ErrorMessage); } } return(View()); } }
public ActionResult Create([Bind(Include = "ID,nombre,numeroAutores")] DesarrolloSoftware desarrolloSoftware) { if (ModelState.IsValid) { db.DesarrolloSoftwares.Add(desarrolloSoftware); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(desarrolloSoftware)); }
// GET: DesarrolloSoftware/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DesarrolloSoftware desarrolloSoftware = db.DesarrolloSoftwares.Find(id); if (desarrolloSoftware == null) { return(HttpNotFound()); } return(View(desarrolloSoftware)); }