Exemplo n.º 1
0
        public HttpResponseMessage CargueMasivoGiftCards([FromBody] SintomasDTO[] sintomasUsuario)
        {
            try
            {
                NegocioSintomas negocioSintomas = new NegocioSintomas();

                var lista = negocioSintomas.CargueSintomasUsuario(sintomasUsuario);
                return(Request.CreateResponse(HttpStatusCode.OK, lista));
            }
            catch (ExceptionControlada ex)
            {
                log.EscribirLogError(ex.Message, ex);
                return(Request.CreateResponse(HttpStatusCode.NotFound, new ApiException(HttpStatusCode.NotFound, ex.Message, ex)));
            }
            catch (Exception ex)
            {
                log.EscribirLogError("Error al cargar datos de sintomas", ex);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, Mensajes.DescFallo));
            }
        }
Exemplo n.º 2
0
        public HttpResponseMessage GetSintomas()
        {
            try
            {
                NegocioSintomas         negocioSintomas        = new NegocioSintomas();
                List <ListaSintomasDto> listaSintomasResultado = new List <ListaSintomasDto>();
                List <Sintoma>          lstSintomasResultado   = negocioSintomas.ObtenerSintomas();

                foreach (var sintoma in lstSintomasResultado)
                {
                    ListaSintomasDto item = new ListaSintomasDto()
                    {
                        codSintoma  = sintoma.codSintoma,
                        descripcion = sintoma.descripcion,
                        opcion      = sintoma.opcion,
                        estado      = false
                    };
                    listaSintomasResultado.Add(item);
                }

                if (lstSintomasResultado.Count == 0)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotFound, Mensajes.MsgSintomasInexistente));
                }
                return(Request.CreateResponse(HttpStatusCode.OK, listaSintomasResultado));
            }
            catch (ExceptionControlada ex)
            {
                log.EscribirLogError(Mensajes.MsgSintomasError, ex);
                return(Request.CreateResponse(HttpStatusCode.Conflict, new ApiException(HttpStatusCode.Conflict,
                                                                                        ex.Message, ex)));
            }
            catch (Exception ex)
            {
                log.EscribirLogError(Mensajes.MsgErrorNoEspacificado, ex);
                return(Request.CreateResponse(HttpStatusCode.InternalServerError,
                                              new ApiException(HttpStatusCode.InternalServerError, Mensajes.MsgErrorNoEspacificado, ex)));
            }
        }