public async Task <bool> AddNewCategory(GetAllCategoriesblogViewItem category)
        {
            var url         = $"/Blog/addCategory";
            var json        = JsonConvert.SerializeObject(category);
            var httpContent = new StringContent(json, Encoding.UTF8, "application/json");
            var result      = await _httpService.ExecuteQuery(url, HttpOperationMode.POST, httpContent);

            return(result.IsSuccessStatusCode);
        }
Exemplo n.º 2
0
        public async Task AddCategory(GetAllCategoriesblogViewItem newCategory)
        {
            Category category = new Category();

            category.CategoryName = newCategory.Category;
            await _categoriesRepository.Add(category);

            await _categoriesRepository.SaveChanges();
        }
Exemplo n.º 3
0
        public async Task <IActionResult> AddCategory([FromBody] GetAllCategoriesblogViewItem newCategory)
        {
            await _postService.AddCategory(newCategory);

            return(Ok());
        }