예제 #1
0
        public async Task <Category> AddCategoryAsync(Category Category)
        {
            var CategoryEntity = mapper.Map <CategoryEntity>(Category);

            CategoriesRepository.CreateCategory(CategoryEntity);
            if (await CategoriesRepository.SaveChangesAsync())
            {
                return(mapper.Map <Category>(CategoryEntity));
            }

            throw new Exception("There were an error with the DB");
        }