public IList <EquivalenciaEntreUnidadesDeMedidaViewModel> Find(string text, int?fromIndex = null, int?toIndex = null)
        {
            IList <EquivalenciaEntreUnidadesDeMedida> modelObjs = null;

            if (string.IsNullOrEmpty(text))
            {
                modelObjs = _service.Find(p => true, fromIndex, toIndex);
            }
            else
            {
                modelObjs = _service.Find(
                    p => (p.Nome.ToLower().Contains(text.ToLower()))

                    || (p.Origem.Id.ToString().ToLower().Contains(text.ToLower())) ||
                    (p.Origem.Nome.ToLower().Contains(text.ToLower())) ||
                    (p.Origem.NomeResumido.ToLower().Contains(text.ToLower())) ||
                    (p.Origem.Sinonimos.ToLower().Contains(text.ToLower()))

                    || (p.Destino.Id.ToString().ToLower().Contains(text.ToLower())) ||
                    (p.Destino.Nome.ToLower().Contains(text.ToLower())) ||
                    (p.Destino.NomeResumido.ToLower().Contains(text.ToLower())) ||
                    (p.Destino.Sinonimos.ToLower().Contains(text.ToLower()))

                    || (p.Sinonimos.ToLower().Contains(text.ToLower()))
                    , fromIndex, toIndex);
            }
            return(_mapper.Map <List <EquivalenciaEntreUnidadesDeMedidaViewModel> >(modelObjs));
        }
        public IList <AvaliacaoDoUsuarioViewModel> Find(string text, int?fromIndex = null, int?toIndex = null)
        {
            IList <AvaliacaoDoUsuario> modelObjs = null;

            if (string.IsNullOrEmpty(text))
            {
                modelObjs = _service.Find(p => true, fromIndex, toIndex);
            }
            else
            {
                modelObjs = _service.Find(
                    p => (p.Nome.ToLower().Contains(text.ToLower()))

                    || (p.UsuarioId.ToString().ToLower().Contains(text.ToLower())) ||
                    (p.Usuario.Nome.ToLower().Contains(text.ToLower()))

                    || ((p.ReceitaId ?? Guid.Empty).ToString().ToLower().Contains(text.ToLower())) ||
                    (p.Receita == null ? false : p.Receita.Nome.ToLower().Contains(text.ToLower()))

                    || ((p.ReceitaDeQuemEhAvaliacaoMediaId ?? Guid.Empty).ToString().ToLower().Contains(text.ToLower())) ||
                    (p.ReceitaDeQuemEhAvaliacaoMedia == null ? false : p.ReceitaDeQuemEhAvaliacaoMedia.Nome.ToLower().Contains(text.ToLower()))

                    || (p.QuantidadeEstrelas.ToString().ToLower().Contains(text.ToLower()))

                    || (p.Sinonimos.ToLower().Contains(text.ToLower()))
                    , fromIndex, toIndex);
            }
            return(_mapper.Map <List <AvaliacaoDoUsuarioViewModel> >(modelObjs));
        }
コード例 #3
0
        public virtual IActionResult Find(int id)
        {
            var result = _service.Find(id);

            if (result == null)
            {
                return(NotFound());
            }
            return(Ok(result));
        }
コード例 #4
0
        public IActionResult DeletarDoCarrinho(int clienteId, int carrinhoId, int produtoId)
        {
            if (!ClienteValido(clienteId))
            {
                return(Forbid());
            }

            var produto = _produtoService.Find(x => x.Id == produtoId);

            produto.RemoverDoCarrinho();

            return(Ok());
        }
        private List <ItemParaComputarIngrediente> ObterDadosAgrupados(Guid id)
        {
            var from          = 0;
            var to            = -1;
            var itensCardapio = _itemService.Find(p => p.CardapioId == id, from, to);

            ItemParaComputarIngrediente  ocor         = null;
            List <ItemListaIngredientes> itensIng     = null;
            ItemListaIngredientes        itemIngAtual = null;

            var agrupadoPorIng = new List <ItemParaComputarIngrediente>();

            foreach (var item in itensCardapio)
            {
                var itensCardRec = _itemReceitaService.Find(p => p.ItemCardapioId == item.Id, 0, -1);

                foreach (var itemCardRec in itensCardRec)
                {
                    itensIng = _ingredientesService.Find(p => p.ReceitaId == itemCardRec.ReceitaId, 0, -1).ToList();
                    foreach (var itemIng in itensIng)
                    {
                        itemIngAtual = itemIng;
                        //procura nos agrpamentos
                        ocor = agrupadoPorIng.Find(p => p.IngredienteId == itemIngAtual.Ingrediente.Id &&
                                                   p.UnidadeMedidaId == itemIngAtual.UnidadeMedidaId);

                        if (ocor == null)
                        {
                            ocor = new ItemParaComputarIngrediente(_receitaService, _param)
                            {
                                IngredienteId     = itemIngAtual.Ingrediente.Id,
                                NomeIngrediente   = itemIngAtual.Ingrediente.Nome,
                                QuantidadeTotal   = 0.0,
                                UnidadeMedidaId   = itemIngAtual.UnidadeMedidaId,
                                NomeUnidadeMedida = itemIngAtual.UnidadeMedida.Nome,
                                NomeCategoria     = ObterCaminhoCategoria(itemIngAtual.Ingrediente)
                            };

                            ocor.Add(item, itemIngAtual.Receita, itemIngAtual);
                            agrupadoPorIng.Add(ocor);
                        }
                        else
                        {
                            ocor.Add(item, itemIngAtual.Receita, itemIngAtual);
                        }
                    }
                }
            }

            return(agrupadoPorIng);
        }
コード例 #6
0
        public string GetBy(string propertyName, string propertyValue, bool isExcludeDeleted = false)
        {
            ICollection <QueryFilter> filters = new List <QueryFilter>();

            filters.Add(new QueryFilter(propertyName, propertyValue, Operator.Equals));
            if (isExcludeDeleted)
            {
                filters.Add(new QueryFilter("IsDeleted", "0"));
            }

            Expression <Func <TEntity, bool> > query = ExpressionBuilder.GetExpression <TEntity>(filters);
            IList <TEntity> entities = _service.Find(query).ToList();
            string          result   = entities.Any() ? JsonHelper <TEntity> .Serialize(entities[0]) : string.Empty;

            return(result);
        }
        public IList <CardapioViewModel> Find(string text, int?fromIndex = null, int?toIndex = null)
        {
            IList <Cardapio> modelObjs = null;

            if (string.IsNullOrEmpty(text))
            {
                modelObjs = _service.Find(p => true, fromIndex, toIndex);
            }
            else
            {
                modelObjs = _service.Find(
                    p => (p.Nome.ToLower().Contains(text.ToLower())) ||
                    (p.Sinonimos.ToLower().Contains(text.ToLower()))
                    , fromIndex, toIndex);
            }
            return(_mapper.Map <List <CardapioViewModel> >(modelObjs));
        }
コード例 #8
0
        public string Find(ICollection <QueryFilter> filters)
        {
            Expression <Func <TEntity, bool> > query = ExpressionBuilder.GetExpression <TEntity>(filters);
            IEnumerable <TEntity> entities           = _service.Find(query).ToList();
            string result = entities.Any() ? JsonHelper <TEntity> .Serialize(entities) : string.Empty;

            return(result);
        }
コード例 #9
0
        private bool ClienteValido(int clienteId)
        {
            if (_clienteService.Find(x => x.Id == clienteId) == null)
            {
                return(false);
            }

            return(true);
        }
コード例 #10
0
        public IList <FontePropriedadeIntelectualViewModel> Find(string text, int?fromIndex = null, int?toIndex = null)
        {
            IList <FontePropriedadeIntelectual> modelObjs = null;

            if (string.IsNullOrEmpty(text))
            {
                modelObjs = _service.Find(p => true, fromIndex, toIndex);
            }
            else
            {
                modelObjs = _service.Find(
                    p => (p.Nome.ToLower().Contains(text.ToLower())) ||
                    (p.EdicaoDoLivro.ToLower().Contains(text.ToLower())) ||
                    (p.Titulo.ToLower().Contains(text.ToLower())) ||
                    (p.Sinonimos.ToLower().Contains(text.ToLower()))
                    , fromIndex, toIndex);
            }
            return(_mapper.Map <List <FontePropriedadeIntelectualViewModel> >(modelObjs));
        }
コード例 #11
0
        public IActionResult BuscarPorId(int id)
        {
            var cliente = _service.Find(x => x.Id == id);

            if (cliente == null)
            {
                return(NotFound());
            }

            return(Ok(cliente));
        }
コード例 #12
0
        protected ActionResult Find(Guid id)
        {
            var response = _service.Find(id);

            if (response == null)
            {
                return(NotFound());
            }

            return(Ok(MapperHelper.Map <T, TDto>(response)));
        }
コード例 #13
0
        public IList <CategoriaViewModel> Find(string text, int?fromIndex = null, int?toIndex = null)
        {
            IList <Categoria> modelObjs = null;

            if (string.IsNullOrEmpty(text))
            {
                modelObjs = _service.Find(p => true, fromIndex, toIndex);
            }
            else
            {
                modelObjs = _service.Find(
                    p => (p.Nome.ToLower().Contains(text.ToLower()))

                    || ((p.CategoriaPaiId ?? Guid.Empty).ToString().ToLower().Contains(text.ToLower())) ||
                    (p.CategoriaPai == null ? false : p.CategoriaPai.Nome.ToLower().Contains(text.ToLower()))

                    || (p.Sinonimos.ToLower().Contains(text.ToLower()))
                    , fromIndex, toIndex);
            }
            return(_mapper.Map <List <CategoriaViewModel> >(modelObjs));
        }
コード例 #14
0
        public IList <EtapaDePreparoViewModel> Find(string text, int?fromIndex = null, int?toIndex = null)
        {
            IList <EtapaDePreparo> modelObjs = null;

            if (string.IsNullOrEmpty(text))
            {
                modelObjs = _service.Find(p => true, fromIndex, toIndex);
            }
            else if (text.ToLower().Contains("receitaid="))
            {
                var receitaId = text.Substring(10);

                modelObjs = _service.Find(p => p.ReceitaId.ToString() == receitaId, fromIndex, toIndex);
            }
            else
            {
                modelObjs = _service.Find(
                    p => (p.Nome.ToLower().Contains(text.ToLower())) ||
                    (p.Sinonimos.ToLower().Contains(text.ToLower()))
                    , fromIndex, toIndex);
            }
            return(_mapper.Map <List <EtapaDePreparoViewModel> >(modelObjs));
        }
コード例 #15
0
 public TEntity Find(params object[] Keys)
 {
     return(_service.Find(Keys));
 }
コード例 #16
0
 public IList <TViewModel> Find(Func <TModel, bool> predicate)
 {
     return(_mapper.Map <IList <TViewModel> >(_service.Find(predicate)));
 }
コード例 #17
0
 public IEnumerable <TEntity> Find(Expression <Func <TEntity, bool> > predicate)
 {
     return(_application.Find(predicate));
 }
コード例 #18
0
ファイル: AppServiceBase.cs プロジェクト: HOMEFW/FWS
 public IList <TEntity> Find(Func <TEntity, bool> lista)
 {
     return(_service.Find(lista));
 }
コード例 #19
0
 public IEnumerable <TEntity> Find(Expression <Func <TEntity, bool> > predicate)
 {
     return(_repositorio.Find(predicate));
 }
コード例 #20
0
 public async Task <T> Find(int id)
 {
     return(await _service.Find(id));
 }
コード例 #21
0
 public TEntity Find(Expression <Func <TEntity, bool> > match)
 {
     return(_serviceBase.Find(match));
 }
コード例 #22
0
 public List <TEntity> Find(System.Linq.Expressions.Expression <Func <TEntity, bool> > expression) => _serviceAppBase.Find(expression);
コード例 #23
0
 /// <summary>
 /// Edit Record
 /// </summary>
 /// <param name="Id"></param>
 /// <returns></returns>
 public virtual async Task <ActionResult> Edit(TKey Id)
 => View(await _service.Find(Id));
コード例 #24
0
 public TEntity Find(TEntity obj)
 {
     return(_serviceBase.Find(obj));
 }
コード例 #25
0
 public TEntity Find(Expression <Func <TEntity, bool> > filter)
 {
     return(_serviceBase.Find(filter));
 }
コード例 #26
0
ファイル: AppBase.cs プロジェクト: ldamascena/Intranet.Web
 public IEnumerable <TEntity> Find(Func <TEntity, bool> expr)
 {
     return(_service.Find(expr));
 }