public PartialViewResult _OfertaSectorEmpresarialCrear(OfertaSectorEmpresarial ofertaSector) { if (ModelState.IsValid) { TicketEmpresa ticket = (TicketEmpresa)Session["TicketEmpresa"]; //ofertaSector.IdOferta = 13; //ofertaSector.SectorEmpresarial.IdListaValor = "ABE"; //ofertaSector.ExperienciaExcluyente = false; //ofertaSector.AniosTrabajados = 3; ofertaSector.EstadoOfertaSectorEmpresarial.IdListaValor = "OFSEAC"; //Oferrta sector empresarial activa. ofertaSector.CreadoPor = ticket.Usuario; LNOfertaSectorEmpresarial lnOfertaSector = new LNOfertaSectorEmpresarial(); lnOfertaSector.Insertar(ofertaSector); List<OfertaSectorEmpresarial> lista = lnSector.ObtenerSectoresEmpresariales(ofertaSector.IdOferta, 0); ViewBag.IdOferta = ofertaSector.IdOferta; return PartialView("_OfertaSectorEmpresarial", lista); } else { //Código para ubicar los errores en el ModelState. var errors = ModelState.Select(x => x.Value.Errors) .Where(y => y.Count > 0) .ToList(); int a = 0; } return PartialView("_OfertaSectorEmpresarialCrear", ofertaSector); }
public PartialViewResult _OfertaSectorEmpresarialEditar(OfertaSectorEmpresarial ofertaSector) { if (ModelState.IsValid) { TicketEmpresa ticket = (TicketEmpresa)Session["TicketEmpresa"]; //ofertaSector.IdOferta = 13; //ofertaSector.SectorEmpresarial.IdListaValor = "ABE222"; //ofertaSector.ExperienciaExcluyente = false; //ofertaSector.AniosTrabajados = 7; //ofertaSector.EstadoOfertaSectorEmpresarial.IdListaValor = "AWE222"; ofertaSector.ModificadoPor = ticket.Usuario; LNOfertaSectorEmpresarial lnOfertaSector = new LNOfertaSectorEmpresarial(); lnOfertaSector.Actualizar(ofertaSector); List<OfertaSectorEmpresarial> lista = lnSector.ObtenerSectoresEmpresariales(ofertaSector.IdOferta, 0); ViewBag.IdOferta = ofertaSector.IdOferta; return PartialView("_OfertaSectorEmpresarial", lista); } //TODO: Validar cuando existe error al grabar. return PartialView("_OfertaSectorEmpresarialEditar", ofertaSector); }