Esempio n. 1
0
        public async Task <Advertisement> InsertAdvertisementAsync(Advertisement advertisement)
        {
            DAL.Entities.Advertisement dbAdvertisement = _mapper.Map <DAL.Entities.Advertisement>(advertisement);
            _context.Advertisements.Add(dbAdvertisement);

            await _context.SaveChangesAsync();

            return(_mapper.Map <Advertisement>(dbAdvertisement));
        }
Esempio n. 2
0
        public async Task <Category> AddCategoryAsync(Category category)
        {
            var dbCategory = _mapper.Map <DAL.Entities.Category>(category);

            _context.Categories.Add(dbCategory);
            await _context.SaveChangesAsync();

            return(_mapper.Map <Category>(dbCategory));
        }