Exemplo n.º 1
0
        public ActionResult Index(int idJob = -1)
        {
            JobModel pm = new JobModel();

            try
            {
                DataSet ds = new DataSet();
                PruebaTecnica_SaonGroup.Conection.Conection conection;
                conection = new PruebaTecnica_SaonGroup.Conection.Conection();

                if (idJob > 0)
                {
                    ds = conection.EjecutarConsultas(new General().EliminarRegistro(idJob));
                    ViewBag.TheResult = true;
                }
                ds = conection.EjecutarConsultas(new General().ConsultarRegistros());

                List <Job> jobs = new List <Job>();
                jobs = new AccesoDatos().ConvertDataTable <Job>(ds.Tables[0]);

                pm.Jobs       = jobs;
                pm.TotalCount = pm.Jobs.Count();
                pm.TotalCount = (pm.TotalCount / pm.PageSize) - (pm.TotalCount % pm.PageSize == 0 ? 1 : 0);
            }
            catch (Exception ex)
            {
                ViewBag.TheResult = false;
            }

            return(View(pm));
        }
        public ActionResult Registro(Job job)
        {
            PruebaTecnica_SaonGroup.Conection.Conection conection;

            try
            {
                conection = new PruebaTecnica_SaonGroup.Conection.Conection();
                if (job.idJob > 0)
                {
                    conection.EjecutarConsultas(new PruebaTecnica_SaonGroup.Process.General().EditarRegistro(job));
                }
                else
                {
                    conection.EjecutarConsultas(new PruebaTecnica_SaonGroup.Process.General().CrearRegistro(job));
                }
            }
            catch (Exception ex) {
            }

            return(RedirectToAction("Index", "Home"));
        }