Ejemplo n.º 1
0
        public async Task <int> GetRemainingUsers(int garageId)
        {
            var garage = await _garageFactory.GetGarage(garageId);

            var currentUsers = await GetUsersForClaim("GarageId", garageId.ToString());

            if (garage == null)
            {
                throw new ApplicationException($"Garage id {garageId} not found in database");
            }

            var maxUserCount     = garage.NbrUser;
            var currentUserCount = currentUsers.Count();

            return((maxUserCount - currentUserCount) < 0 ? 0 : (maxUserCount - currentUserCount));
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <OptionViewModel> > GetRecommendationList(int garageId)
        {
            var result = new List <OptionViewModel>();

            var garage = await _garageFactory.GetGarage(garageId);

            var optionBaseList = await _optionFactory.GetBaseOptions(OptionTypeEnum.Recommendation, garage.Language);

            result.AddRange(optionBaseList.Adapt <IEnumerable <OptionViewModel> >());

            var reommendationList = await _optionFactory.GetOptions(OptionTypeEnum.Recommendation, garageId);

            result.AddRange(reommendationList.Adapt <IEnumerable <OptionViewModel> >());

            return(result);
        }
Ejemplo n.º 3
0
        public async Task <GarageViewModel> GetGarage(int garageId)
        {
            var garage = await _garageFactory.GetGarage(garageId);

            return(garage.Adapt <GarageViewModel>());
        }