Exemple #1
0
        public IActionResult AddCategory([FromBody] Category category)
        {
            string entity    = "{\"ID\":\"" + category.ID + "\",\"Title\":\"" + category.Title + "\"" + ",\"Status\":\"" + category.Status + "\"},";
            var    category1 = JsonConvert.DeserializeObject <Category>(entity);

            _category.AddCategory(entity);
            return(Ok());
        }
Exemple #2
0
        /// <summary>
        /// AddCategory
        /// </summary>
        /// <param name="request">AddCategoryRequest</param>
        /// <returns>bool</returns>
        public async Task <bool> AddCategory(AddCategoryRequest request)
        {
            bool result = false;

            try
            {
                var param = new AddCategoryParameter()
                {
                    nameCategory = request.nameCategory,
                    imgCategory  = request.imgCategory
                };
                _dataAccess.AddCategory(param);
                result = true;
                return(result);
            }
            catch (Exception)
            {
                result = false;
            }
            return(await Task.FromResult(result));
        }