Questions tagged as 'linq'

1
answer

OneToMany entity mapping with Fluent NHibernate

Gentlemen, my problem is apparently simple, I must be doing or forgetting something and I just can not see the error. Can you help me? I have class Cliente : public class Cliente { public Cliente () { } public virtual...
asked by 08.07.2015 / 14:05
2
answers

Create a join between two classes in my repository

I have a repository for my PessoaCadastro class that relates to the Pessoa class. I need to create a GetJoinAll(...) method that shows me all records in the PessoaCadastro table that are related to Pessoa throu...
asked by 13.02.2018 / 20:51
3
answers

How to get the amount of "true"?

Follow the code below: int total_true = ctx .MinhaTabela .Where(x => x.id == 5) .Select(x => new Tabela_DTO { Campo1 = x.Campo1, // database está como true Campo2 = x.Campo2, //database está como false...
asked by 31.07.2018 / 19:47
2
answers

How to get items from a json in C #

After almost 3 days trying to implement I was not successful. I have the following json: { "code": 200, "data": [ { "id": 1, "type": "charge", "custom_id": "1208", "status": { "current": "new", "previous": null }, "identifiers": { "charge_i...
asked by 03.12.2018 / 18:14
1
answer

LINQ query for object with a sub list

I have the following structure: public class Insumo{ public int Insumo_id { get; set; } public List<InsumoDados> Dados{ get; set; } } public class InsumoDados{ public int Desc { get; set; } public decimal Valor{ get; set...
asked by 27.07.2018 / 23:39
2
answers

doubts with linq to sql

Personal I have two tables, sale and sale Items: Sale: [Table("venda")] public class VendaModel { [Key] [Required] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int id_venda { get; set; } public DateTime dt...
asked by 05.07.2018 / 00:40
2
answers

Linq equivalent to the t-sql command

How to make LINQ equivalent to the following SQL? Select sum(case when periodo = 1 then isnull(valor,0) else 0 end) Jan, sum(case when periodo = 2 then isnull(valor,0) else 0 end) Feb, sum(case when periodo = 3 then isnull(valo...
asked by 06.06.2018 / 21:20
1
answer

Doubt in the construction of WS REST (Contract)

Gentlemen, I took an example in the book of John Sharp (Microsoft Press) to build a REST and came up with a simple question but a question of good practice. It uses the Northwind BD. It creates a Class Library project and points this project...
asked by 12.05.2014 / 14:28
1
answer

Result of foreach behaves unexpectedly

I've been working on a page, where I need to create a treeview system with checkbox and this is consuming a lot of my time and leaves me worried about the project SLA. In the controller, there I have a LINQ that returns everything I need on the...
asked by 18.09.2014 / 15:45
1
answer

Help convert SQL into LINQ

I want to convert the code select to a query LINQ SELECT bpac.cmp FROM bpac union SELECT bpai.cmp FROM bpai group by cmp order by cmp desc I'm trying to get the first table and I'm already getting error: List<string> l...
asked by 02.10.2018 / 15:43