public List <NegocioUbicacionObtenerPorIdNegocioDto> ObtenerPorIdNegocio(RequestNegocioUbicacionObtenerPorIdNegocioDto filtro) { //Obtener Negocio Ubicacion List <NegocioUbicacionObtenerPorIdNegocioDto> resultado = new List <NegocioUbicacionObtenerPorIdNegocioDto>(); try { const string query = "Maestro.usp_NegocioUbicacion_ObtenerPorIdNegocio"; using (var cn = HelperClass.ObtenerConeccion()) { if (cn.State == ConnectionState.Closed) { cn.Open(); } resultado = cn.Query <NegocioUbicacionObtenerPorIdNegocioDto>(query, new { filtro.Buscar, filtro.IdNegocio, filtro.NumeroPagina, filtro.CantidadRegistros, filtro.ColumnaOrden, filtro.DireccionOrden }, commandType: CommandType.StoredProcedure).ToList(); } } catch (Exception ex) { Log(Level.Error, (ex.InnerException == null ? ex.Message : ex.InnerException.Message)); } return(resultado); }
//Obtener Ubicacion de Negocio public List<NegocioUbicacionObtenerPorIdNegocioDto> ObtenerPorIdNegocio(RequestNegocioUbicacionObtenerPorIdNegocioDto filtro) { if (filtro == null) filtro = new RequestNegocioUbicacionObtenerPorIdNegocioDto(); if (filtro.NumeroPagina == 0) filtro.NumeroPagina = 1; if (filtro.CantidadRegistros == 0) filtro.CantidadRegistros = 10; if (string.IsNullOrEmpty(filtro.ColumnaOrden)) filtro.ColumnaOrden = "IdNegocioUbicacion"; if (string.IsNullOrEmpty(filtro.DireccionOrden)) filtro.DireccionOrden = "desc"; var lista = _adNegocioUbicacion.ObtenerPorIdNegocio(filtro); if (lista == null) { lista = new List<NegocioUbicacionObtenerPorIdNegocioDto>(); } return lista; }
public async Task <ActionResult <ResponseNegocioUbicacionObtenerPorIdNegocioDto> > ObtenerPorIdNegocio([FromBody] RequestNegocioUbicacionObtenerPorIdNegocioDto filtro) { ResponseNegocioUbicacionObtenerPorIdNegocioDto respuesta = new ResponseNegocioUbicacionObtenerPorIdNegocioDto(); var result = await Task.FromResult(_lnNegocioUbicacion.ObtenerPorIdNegocio(filtro)); respuesta.ProcesadoOk = 1; respuesta.Cuerpo = result; if (result.Any()) { respuesta.CantidadTotalRegistros = result.First().TotalItems; } return(Ok(respuesta)); }