Questions tagged as 'linq'

3
answers

Use of "Contains" in search expression

I have a string _Users of type List , it contains several lines. Each line consists of an integer and a comma-separated string (usually just a string): ID (numbers only), name (letters and numbers ). What I'm trying to do is...
asked by 23.11.2018 / 21:44
3
answers

How to concatenate sublists from a list and add values to them using Linq with C #

Hello, I have the following 2 classes: public class EstoqueItem { [Key] public int Id { get; set; } public decimal Qtd { get; set; } public Estoque Estoque { get; set;} } public class Estoque { [Key] public int Id {...
asked by 14.09.2018 / 15:30
1
answer

Conducting a query linq C #

I have a controller where I make a Select to get a list, but it returns empty. public IEnumerable<Check> GetUserByNumberOfregistration(int numberOfregistrationUser) { CheckContext contextObj = new CheckContext(); var resu...
asked by 06.02.2018 / 00:53
2
answers

Sort List by Field String

I have a list with attributes, of which I have the field of evaluations, containing: Excellent, Good, Regular, Bad, and Poor. The information for this field I get from consuming a REST API using JSON. Example: IEnumerable<minhaEntidade...
asked by 04.06.2018 / 22:49
2
answers

How to run a subquery in LINQ C #?

How to run a subquery in LINQ C #? SELECT ap.ID FROM Aplicativo AP WHERE AP.Tipo IN (2,6) AND AP.ID NOT IN (SELECT filhoID FROM relacoesobjeto WHERE filhoclasse = 555)     
asked by 10.04.2018 / 19:11
1
answer

Error when adding SUM

I'm trying to implement SUM within these lines of code to sum the two columns Litro and TotalGasto Code: var teste = consulta.Where(i => i.DtAbastecido >= dataInicio && i.Dt...
asked by 01.02.2018 / 20:35
1
answer

Linq to sql with subquery

I have two tables, and I would like to get only the data from table A by filtering through the related table B. I would like to know how to write this query with Linq to Sql in C #. I've written the example below on Sql Server to make understand...
asked by 25.09.2017 / 21:26
1
answer

Group objects and add values

I have a ListaBid class with multiple objects, in this class there are attributes Partnumber(Chave) , Quantidade SaldoPartnumber . I can have X objects with partnumber Y and other X objects with% co_of...
asked by 11.09.2017 / 16:46
1
answer

How to use SUM in a string field, converting the value to int?

I have a table that has a PA field that is string , it stores a 10-digit number and I can not change the type of it because it references another table. I'm trying to add this field like this: Int32 somaBpaC = modelOff.bpacs.Sum(...
asked by 25.08.2017 / 21:10
1
answer

Adding C # DataTable columns with Linq

I have a DataTable that contains a column named SubTotal . I would like to add the total value of this column. I tested some examples: object sumObject; sumObject = table.Compute("Sum(Amount)", ""); This too: this.LabelCon...
asked by 15.02.2017 / 21:08