Esempio n. 1
0
        public IActionResult ReadCSV(string file)
        {
            IAreaSolicitanteService            service  = new AreaSolicitanteService(DbContext);
            Response <List <AreaSolicitante> > response = new Response <List <AreaSolicitante> >();

            try
            {
                List <AreaSolicitante> p = service.migrateCsvData(file).Result;
                response.ok(true, p, "La siguiente lista fue migrada");
                return(Ok(response));
            }
            catch (Exception ex)
            {
                response.ok(false, new List <AreaSolicitante>(), "Error al Migrar la data " + ex.Message);
                return(BadRequest(response));
            }
        }
Esempio n. 2
0
        public IActionResult SaveAreaSolicitante(AreaSolicitante areasolicitante)
        {
            Response <AreaSolicitante> response = new Response <AreaSolicitante>();

            try
            {
                IAreaSolicitanteService service = new AreaSolicitanteService(DbContext);
                Task <AreaSolicitante>  p       = service.save(areasolicitante);
                response.ok(true, p.Result, "Se inserto el area solicitante");
                return(Ok(response));
            }
            catch (Exception ex)
            {
                response.ok(false, null, "Error en el servicio " + ex.Message);
                return(BadRequest(response));
            }
        }
Esempio n. 3
0
        public IActionResult DeleteProductById(int Id)
        {
            IAreaSolicitanteService    service  = new AreaSolicitanteService(DbContext);
            Response <AreaSolicitante> response = new Response <AreaSolicitante>();

            try
            {
                AreaSolicitante p = service.deleteById(Id).Result;
                response.ok(true, p, "Se cambio el estado a DELETE");
                return(Ok(response));
            }
            catch (Exception ex)
            {
                response.ok(false, new AreaSolicitante(), "Error al cambiar estado " + ex.Message);
                return(BadRequest(response));
            }
        }
Esempio n. 4
0
        public IActionResult Get()
        {
            Response <List <AreaSolicitante> > response = new Response <List <AreaSolicitante> >();
            IAreaSolicitanteService            p        = new AreaSolicitanteService(DbContext);

            try
            {
                List <AreaSolicitante> listApplicantAreas = p.finAll().Result;
                response.ok(true, listApplicantAreas, "Lista de areas solicitantes regristradas");
                return(Ok(response));
            }
            catch (Exception ex)
            {
                response.ok(false, new List <AreaSolicitante>(), "No hay areas solicitantes en la lista");
                return(BadRequest(response));
            }
        }