Exemple #1
0
        public async Task <BrandUpdateDtoModel> GetBrandByIdAsync(int id)
        {
            var currentBrand = await this.brands.All().FirstOrDefaultAsync(x => x.Id == id);

            var brandDto = BrandServiceUpdateDtoMapper.Map(currentBrand);

            return(brandDto);
        }
Exemple #2
0
        /// <summary>
        /// method - find and get brand by id param from database
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public async Task <BrandUpdateDtoModel> GetBrandByIdAsync(int id)
        {
            var brandsAll = this.brands.All();
            var allBrands = await EfExtensions.ToListAsyncSafe <Brand>(brandsAll);

            var currentBrand = allBrands.FirstOrDefault(x => x.Id == id);
            var brandDto     = BrandServiceUpdateDtoMapper.Map(currentBrand);

            return(brandDto);
        }