public IEnumerable <UserView> GetUsers() { using var ctx = new WorkshopContext(); var users = ctx.Users; return(users.Select(u => ViewMapper.GetViewModell(u)).ToList()); }
public IEnumerable <BonusView> GetBonuses() { using var ctx = new WorkshopContext(); var brs = ctx.Bonuses.Select(b => ViewMapper.GetViewModell(b)).ToList(); return(brs); }
public IEnumerable <ManagerView> GetManagers() { using var ctx = new WorkshopContext(); var managers = ctx.Managers.Include(m => m.User).ToList(); return(managers.Select(m => ViewMapper.GetViewModell(m)).ToList()); }
public IEnumerable <RepairTechnicianView> GetRepairTechnicians() { using var ctx = new WorkshopContext(); return(ctx.RepairTechnicians.Select(rt => ViewMapper.GetViewModell(rt)).ToList() ?? new List <RepairTechnicianView>()); }
public IEnumerable <BonusRepairView> GetBonusRepairs() { using var ctx = new WorkshopContext(); var brs = ctx.BonusRepairs.Include(br => br.Bonus).Select(br => ViewMapper.GetViewModell(br)).ToList() ?? new List <BonusRepairView>(); return(brs); }
public IEnumerable <RepairLogView> GetRepairLogs(long repairID) { using var ctx = new WorkshopContext(); var ls = (from logs in ctx.RepairLogs.Include(rl => rl.Repair) where logs.Repair.Id == repairID select ViewMapper.GetViewModell(logs)).ToList(); return(ls); }
public IEnumerable <TechnicianView> GetTechniciansByRepairID(long id) { using var ctx = new WorkshopContext(); var technicianIdNumbers = (from jt in ctx.RepairTechnicians.Include(rt => rt.Technician).Include(rt => rt.Repair) where jt.RepairID == id select jt.TechnicianId); return((from t in ctx.Technicians where technicianIdNumbers.Contains(t.Id) select ViewMapper.GetViewModell(t)).ToList() ?? new List <TechnicianView>()); }
public IEnumerable <RepairView> GetRepairs() { using var ctx = new WorkshopContext(); var repairs = ctx.Repairs.Include(r => r.Auto) .ThenInclude(a => a.Client) .Include(r => r.BonusRepairs) .Include(r => r.RepairTechnicians) .Include(r => r.Manager).ThenInclude(r => r.User).ToList(); var rps = repairs.Select(r => ViewMapper.GetViewModell(r)).ToList(); return(rps); }
public IEnumerable <RepairView> GetRepairsByTechnicianID(long id) { using var ctx = new WorkshopContext(); var technicianIdNumbers = (from jt in ctx.RepairTechnicians .Include(rt => rt.Technician) .Include(rt => rt.Repair) where jt.TechnicianId == id select jt.RepairID); return((from t in ctx.Repairs.Include(r => r.Auto) .ThenInclude(a => a.Client) .Include(r => r.Manager).ThenInclude(r => r.User) .Include(r => r.RepairTechnicians) .Include(r => r.BonusRepairs) where technicianIdNumbers.Contains(t.Id) select ViewMapper.GetViewModell(t)).ToList() ?? new List <RepairView>()); }
public TechnicianView GetTechnician(long id) { using var ctx = new WorkshopContext(); return(ViewMapper.GetViewModell(ctx.Technicians.SingleOrDefault(t => t.Id == id))); }
public IEnumerable <RepairLogView> GetRepairLogs() { using var ctx = new WorkshopContext(); return((from logs in ctx.RepairLogs.Include(rl => rl.Repair) select ViewMapper.GetViewModell(logs)).ToList()); }
public IEnumerable <AutoView> GetAutomobiles() { using var ctx = new WorkshopContext(); return(ctx.Automobiles.Include(a => a.Client).Select(a => ViewMapper.GetViewModell(a)) .ToList()); }
public IEnumerable <ClientView> GetClients() { using var ctx = new WorkshopContext(); return(ctx.Clients.Select(c => ViewMapper.GetViewModell(c)) .ToList()); }
public IEnumerable <TechnicianView> GetTechnicians() { using var ctx = new WorkshopContext(); return(ctx.Technicians .Include(t => t.RepairTechnicians).Include(r => r.User).Select(t => ViewMapper.GetViewModell(t)).ToList()); ; }