Beispiel #1
0
        public override Bus GetById(int Id)
        {
            var BusList     = data.busRepo.GetAll();
            var BusTypeList = data.busTypeRepo.GetAll();
            var curbuspoc   = BusList.SingleOrDefault(x => x.Id == Id);

            Bus bus = new Bus();

            bus.Make  = curbuspoc.Make;
            bus.Plate = curbuspoc.Plate;
            BusType bustype = new BusType();

            bustype.Name = BusTypeList.SingleOrDefault(x => x.BusTypeId == curbuspoc.BusTypeId).BusTypeName;
            bus.Type     = bustype;
            return(bus);
        }
Beispiel #2
0
        public override IList <Bus> GetAll()
        {
            List <Bus> Buses       = new List <Bus>();
            var        busPOCs     = data.busRepo.GetAll();
            var        busTypePOCs = data.busTypeRepo.GetAll();


            foreach (var item in busPOCs)
            {
                Bus     currentBus     = new Bus();
                BusType currentBusType = new BusType();
                currentBus.Id       = item.Id;
                currentBus.Make     = item.Make;
                currentBus.Plate    = item.Plate;
                currentBusType.Name = busTypePOCs.SingleOrDefault(x => x.BusTypeId == item.BusTypeId).BusTypeName;
                currentBus.Type     = currentBusType;
                Buses.Add(currentBus);
            }

            return(Buses);
        }