public ActionResult AgregarPresupuesto(int idGrupoInvestigacion)
        {
            tblPresupuestoProyectoInvestigacion tblpresupuesto = new tblPresupuestoProyectoInvestigacion();

            tblpresupuesto.idGrupoInvestigacion = idGrupoInvestigacion;
            ViewBag.idRubro = new SelectList(db.tblRubro, "id", "Rubro");
            return(View(tblpresupuesto));
        }
        public ActionResult EliminarPresupuesto(int id)
        {
            tblPresupuestoProyectoInvestigacion tblpresupuesto = db.tblPresupuestoProyectoInvestigacion.Find(id);
            int idGrupo = tblpresupuesto.idGrupoInvestigacion;

            db.tblPresupuestoProyectoInvestigacion.Remove(tblpresupuesto);
            db.SaveChanges();
            return(RedirectToAction("PresupuestoDetallado", new { id = idGrupo, code = 410 }));
        }
        public ActionResult AgregarPresupuesto([Bind(Include = "id,idGrupoinvestigacion,idRubro,DescripcionGasto,ValorRubro,ValorUnitario,Total")] tblPresupuestoProyectoInvestigacion tbpresupuesto)
        {
            string userId = AspNetUsers.GetUserId(User.Identity.Name);
            int    idRol  = tblMiembroGrupo.GetRoleMiembro(userId, tbpresupuesto.idGrupoInvestigacion);

            if (idRol != 1)
            {
                return(RedirectToAction("Index", new { code = 999, id = tbpresupuesto.idGrupoInvestigacion }));
            }
            if (ModelState.IsValid)
            {
                tbpresupuesto.Total = tbpresupuesto.ValorRubro * tbpresupuesto.ValorUnitario;
                db.tblPresupuestoProyectoInvestigacion.Add(tbpresupuesto);
                db.SaveChanges();
                return(RedirectToAction("Index", new { code = 400, id = tbpresupuesto.idGrupoInvestigacion }));
            }
            ViewBag.idRubro = new SelectList(db.tblRubro, "id", "Rubro");
            return(View(tbpresupuesto));
        }