using bdGrupoSanchoToro.db; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Text.Json.Serialization; using System.Threading.Tasks; namespace bdGrupoSanchoToro.extensiones { public class DesglosePorEmpresa { public int Empresa { get; set; } public double TotalUnidades { get; set; } public double UnidadesInicialesOFabricadas { get; set; } public double UnidadesCompradas { get; set; } public double UnidadesAlquiladas { get; set; } public double UnidadesAveriadas { get; set; } public double UnidadesVendidas { get; set; } public double UnidadesSubAlquiladas { get; set; } public double UnidadesDesechadas { get; set; } [NotMapped] [JsonIgnore] public double UnidadesDisponibles { get { return this.TotalUnidades - this.UnidadesAlquiladas - this.UnidadesAveriadas; } } [NotMapped] [JsonIgnore] public string NombreEmpresa { get { var emp = empresas.ListadoEmpresas().FirstOrDefault(x => x.idEmpresa == Empresa); return emp == null ? "" : emp.RazonSocial; } } } }