public ActionResult DeleteConfirmed(int id)
        {
            ColaboracionEvento colaboracionEvento = db.ColaboracionEventoes.Find(id);

            db.ColaboracionEventoes.Remove(colaboracionEvento);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,nombreEvento,nombreEntidad")] ColaboracionEvento colaboracionEvento)
 {
     if (ModelState.IsValid)
     {
         db.Entry(colaboracionEvento).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(colaboracionEvento));
 }
        // GET: ColaboracionEvento/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ColaboracionEvento colaboracionEvento = db.ColaboracionEventoes.Find(id);

            if (colaboracionEvento == null)
            {
                return(HttpNotFound());
            }
            return(View(colaboracionEvento));
        }
        public ActionResult CreateColaboracionEvento([Bind(Include = "ID,nombreEvento,nombreEntidad")] ColaboracionEvento colaboracionEvento, HttpPostedFileBase upload, HttpPostedFileBase uploadCert)
        {
            try
            {
                db.ColaboracionEventoes.Add(colaboracionEvento);
                db.SaveChanges();

                PersonaXColaboracionEvento personaX = new PersonaXColaboracionEvento();
                personaX.id_persona      = Int32.Parse(Session["ID"].ToString());
                personaX.id_colaboracion = colaboracionEvento.ID;
                db.PersonaXColaboracionEventoes.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);
                    InsertColabEDoc(System.Guid.NewGuid(), System.IO.Path.GetFileName(upload.FileName), fullPath, 0, colaboracionEvento.ID);
                    //Path.GetFullPath(upload.FileName);
                }
                if (uploadCert != null)
                {
                    upload.SaveAs(Path.Combine(Server.MapPath("~/App_Data/uploads"), uploadCert.FileName));
                    string fullPath = Path.Combine(Server.MapPath("~/App_Data/uploads"), uploadCert.FileName);
                    InsertColabEDoc(System.Guid.NewGuid(), System.IO.Path.GetFileName(uploadCert.FileName), fullPath, 1, colaboracionEvento.ID);
                    //Path.GetFullPath(upload.FileName);
                }

                ViewBag.obraAgregado = colaboracionEvento.nombreEvento;
                return(View());
            }
            catch (DbEntityValidationException dbEx)
            {
                foreach (var validationErrors in dbEx.EntityValidationErrors)
                {
                    foreach (var validationError in validationErrors.ValidationErrors)
                    {
                        ViewBag.errorObra = "Error: " + dbEx;
                        Trace.TraceInformation("Property: {0} Error: {1}",
                                               validationError.PropertyName,
                                               validationError.ErrorMessage);
                    }
                }
                return(View());
            }
        }