Mishkkk

Mishkkk

  • NA
  • 59
  • 1.1k

Entity query - to form a balance

Feb 11 2021 6:34 AM
There is a table:
  1. public partial class Warehouse  
  2.         {  
  3.             public int WarehouseId { get; set; }  
  4.             public int OperationId { get; set; }  
  5.             public DateTime? DateOperation { get; set; }  
  6.             public int NomenclatureId { get; set; }  
  7.             public decimal Quantity { get; set; }  
  8.   
  9.             public virtual Nomenclature Nomenclature { get; set; }  
  10.             public virtual Operation Operation { get; set; }  
  11.         }  
operation - arrival at the warehouse or delivery from the warehouse.
I need to make a Linq query to display the balances as: nomenclature, quantity.
(I understand that I need to add up the amount of the nomenclature, which is income, add up the sum of the nomenclature, which is the issue, and subtract the costs from the income). How to write it in the query?