I have a list of elements as follows
public class MedicamentoDevolverDto
{
public int IdMedicamento { get; set; }
public string CodigoMedicamento { get; set; }
public string Medicamento { get; set; }
public int StockActualCompartimento { get; set; }
public string Color { get; set; }
public int DispensadorId { get; set; }
public int DispensadorBandejaId { get; set; }
public int DispensadorCajonId { get; set; }
public int CarroCajonId { get; set; }
public bool MedicamentoDevolverOK { get; set; }
public decimal CantidadDevolver { get; set; }
public bool Devolver { get; set; }
public string Estado { get; set; }
}
the quantity field, needs to be added, and I must generate a new list, grouped by Drug Id. For this I use the following sentence
var DistinctSumMedicamentos = lstMedicamentosDevolver
.GroupBy(l => l.IdMedicamento)
.Select(la =>
new
{
MedicamentoId = la.Key,
NoArticulos = la.Count(),
SumaCantidad = la.Sum(s => s.CantidadDevolver),
}).ToList();
My problem is, I require that in this new DistinctSumMedicamentos list I also see the name of the medication (Medication).
Look in the select to put the name of the medicine, but I can not find the sentence that allows me to add it.
Can someone help me with this doubt? Greetings and thanks for your time