Ejemplo n.º 1
0
        public async Task <CarSlotInfoTrans> GetCarSlots(int personaId)
        {
            AppPersona persona = await _personaService.FindPersonaById(personaId);

            await _context.Entry(persona)
            .Collection(p => p.OwnedCars)
            .LoadAsync();

            CarSlotInfoTrans carSlotInfoTrans = new CarSlotInfoTrans();

            carSlotInfoTrans.OwnedCarSlotsCount   = persona.OwnedCars.Count;
            carSlotInfoTrans.DefaultOwnedCarIndex = persona.SelectedCarIndex;
            carSlotInfoTrans.CarsOwnedByPersona   = new List <OwnedCarTrans>();
            carSlotInfoTrans.ObtainableSlots      = new List <ProductTrans>();

            foreach (var personaOwnedCar in persona.OwnedCars)
            {
                carSlotInfoTrans.CarsOwnedByPersona.Add(ConvertOwnedCarToContract(personaOwnedCar));
            }

            return(carSlotInfoTrans);
        }
Ejemplo n.º 2
0
 public async Task <ProfileData> GetPersonaInfo([FromQuery] int personaId)
 {
     return(_personaService.GetPersonaInfo(await _personaService.FindPersonaById(personaId)));
 }