Questions tagged as 'linq'

3
answers

Bring a Max (Date) with LINQ

I have this Linq : var resultado = ( from pdv in db.T_PDV from tarefa in db.T_TarefaParceiro.Where(trf => trf.CNPJ == pdv.CNPJ).DefaultIfEmpty() from parceiro in db.T_OsParceiro.Where(prf => prf.IDTarefaParceiro == tarefa...
asked by 13.06.2014 / 22:33
1
answer

Know the size of each element of a list

Assuming I have a List<byte[]> Imagens; and I want to know if any element in this list has more than 1 mega, I could do this via foreach , checking item by item: foreach (var item in Imagens) if (item.Leng...
asked by 15.09.2018 / 17:09
2
answers

How to insert a where inside a linq query

I have the following query : var result = (from line in db.ApadrinhamentoListas group new { line } by new { line.datahora, line.valor_doacao } into grp select new { DataHora = grp.Key.datahora, Valor = grp.Key.v...
asked by 29.11.2017 / 21:11
1
answer

How to do all union in LINQ?

I need to run the command below using Linq : SELECT cnes, cmp, cbo, profNome, pa, sum(quant) total FROM bpai group by pa union all select cnes, cmp, cbo, profissional, pa, sum(quant) total from bpac group by pa All fields are strin...
asked by 31.07.2017 / 20:02
2
answers

How to select the entire object, Lambda C #

I have a difficulty here in this lambda, I would like to know how I select the entire object without having to specify all its properties. As if it were a: SELECT * FROM SomeCase Without having to specify as: SELECT ID, BLA, BLE FROM Some...
asked by 02.08.2017 / 21:39
3
answers

Filter per parameter or all

I query the database using linq. I would like to filter the ID_LEAD column by the value of the filter "if there is an int (filter.code) or filter all over the world. Follow the example of how the procedure is in the bank WHERE ---- @ID_LE...
asked by 17.04.2017 / 21:52
2
answers

Add AND and OR to Where de list

I have a list in C# and the search code is currently like this: filter = lst.Where(s => s.Contains(num.Text) ).Take(3).ToList(); The lst list is based on a list of phone numbers and contact names, for example: 123456789$nome1 9...
asked by 13.06.2016 / 20:53
1
answer

Doubt with join between two classes

I have the Classes: class Procedimento { public string CodProcedimento { get; set; } public string NomeProcedimento { get; set; } public string TpSexo { get; set; } public int IdadeMinima { get; set; }...
asked by 30.01.2017 / 20:02
2
answers

NOT IN in linq using a subquery

I'm using the answer as the basis on: link I need to make a query where it does not contain (NOT IN) the Ids coming from another query. The SQL Query is this: SELECT DISTINCT tbl_boleto.int_IDC, tbl_Admin.* //redução do código FROM...
asked by 08.03.2016 / 16:45
2
answers

How to get data from two tables in the same column?

I have two tables in the database: Tabela1 Id Nome Sexo 1 NomeA Macho 2 NomeC Fêmea Tabela2 Id Nome Sexo 1 NomeB Macho 2 NomeD Fêmea I would like to have the following re...
asked by 30.07.2015 / 18:54