// GET: Aporte/Edit/5 public ActionResult Edit(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } string idDecrypted = MiUtil.desEncriptar(id); int intId = Convert.ToInt32(idDecrypted); //socio socio = db.socio.Find(intSocioId); retiro retiro = db.retiro.Find(intId); if (retiro == null) { return(HttpNotFound()); } int empresaId = 0; if (Session["EmpresaId"] != null) { Int32.TryParse(Session["EmpresaId"].ToString(), out empresaId); } ViewBag.EmpresaId = empresaId; ViewBag.idSocio = retiro.SocioId.ToString(); ViewBag.ConceptoRetiroId = new SelectList(db.conceptoretiro.Where(c => c.Estado == true && c.EmpresaId == empresaId).OrderBy(e => e.Nombre), "ConceptoRetiroId", "Nombre", retiro.ConceptoRetiroId); ViewBag.SocioId = new SelectList(db.socio.Where(c => c.Estado == true).OrderBy(e => e.Nit), "SocioId", "Nit", retiro.SocioId); return(View(retiro)); }
// GET: Aporte/Create public ActionResult Create(string id) { int empresaId = 0; if (Session["EmpresaId"] != null) { Int32.TryParse(Session["EmpresaId"].ToString(), out empresaId); } string socioDecrypted = MiUtil.desEncriptar(id); int intSocioId = Convert.ToInt32(socioDecrypted); socio socio = db.socio.Find(intSocioId); ViewBag.idSocio = intSocioId.ToString(); ViewBag.socioNombre = socio.Nombre; ViewBag.EmpresaId = empresaId; ViewBag.ConceptoRetiroId = new SelectList(db.conceptoretiro.Where(c => c.Estado == true && c.EmpresaId == empresaId).OrderBy(e => e.Nombre), "ConceptoRetiroId", "Nombre"); // ViewBag.SocioId = new SelectList(db.socio.Where(c=>c.Estado==true).OrderBy(e=>e.Nit), "SocioId", "Nit"); retiro a = new retiro(); a.SocioId = intSocioId; a.Fecha = DateTime.Now; a.Estado = true; return(View(a)); //return View(); }
public ActionResult Create([Bind(Include = "RetiroId,Valor,Fecha,SocioId,ConceptoRetiroId,Observacion,Estado,CreadoPor,FechaCreacion,ModificadoPor,FechaModificacion")] retiro retiro, int EmpresaId) { if (ModelState.IsValid) { db.retiro.Add(retiro); db.SaveChanges(); return(RedirectToAction("Index", new { socioId = MiUtil.encriptar(retiro.SocioId.ToString()) })); } ViewBag.EmpresaId = EmpresaId; ViewBag.idSocio = retiro.SocioId.ToString(); ViewBag.ConceptoRetiroId = new SelectList(db.conceptoretiro.Where(c => c.Estado == true && c.EmpresaId == EmpresaId).OrderBy(e => e.Nombre), "ConceptoRetiroId", "Nombre", retiro.ConceptoRetiroId); ViewBag.SocioId = new SelectList(db.socio.Where(c => c.Estado == true).OrderBy(e => e.Nit), "SocioId", "Nit", retiro.SocioId); return(View(retiro)); }
// GET: Aporte/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } string idDecrypted = MiUtil.desEncriptar(id); int intRetiroId = Convert.ToInt32(idDecrypted); retiro retiro = db.retiro.Find(intRetiroId); ViewBag.idSocio = retiro.SocioId.ToString(); if (retiro == null) { return(HttpNotFound()); } return(View(retiro)); }
public ActionResult Edit([Bind(Include = "RetiroId,Valor,Fecha,SocioId,ConceptoRetiroId,Observacion,Estado,CreadoPor,FechaCreacion,ModificadoPor,FechaModificacion")] retiro retiro, int EmpresaId) { if (ModelState.IsValid) { db.Entry(retiro).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index", new { socioId = MiUtil.encriptar(retiro.SocioId.ToString()) })); } ViewBag.idSocio = retiro.SocioId.ToString(); ViewBag.EmpresaId = EmpresaId; //int intSocioId = Convert.ToInt32(socioDecrypted); // socio socio = db.socio.Find(intSocioId); //ViewBag.idSocio = intSocioId.ToString(); ViewBag.ConceptoRetiroId = new SelectList(db.conceptoretiro.Where(c => c.Estado == true && c.EmpresaId == EmpresaId).OrderBy(e => e.Nombre), "ConceptoRetiroId", "Nombre", retiro.ConceptoRetiroId); ViewBag.SocioId = new SelectList(db.socio.Where(c => c.Estado == true).OrderBy(e => e.Nit), "SocioId", "Nit", retiro.SocioId); return(View(retiro)); }