public ActionResult CategoryAdd(CategoryModel Model)
        {
            if (!ModelState.IsValid)
            {
                ViewBag.Parent = new SelectList(_categoryBL.GetListParent(true), "id", "name");
                return(View(Model));
            }
            List <string> lstMsg     = new List <string>();
            int           returnCode = _categoryBL.Insert(Model, out lstMsg);

            if (!((int)Common.ReturnCode.Succeed == returnCode))
            {
                ViewBag.Parent = new SelectList(_categoryBL.GetListParent(true), "id", "name");
                if (lstMsg != null)
                {
                    for (int i = 0; i < lstMsg.Count(); i++)
                    {
                        ModelState.AddModelError(string.Empty, lstMsg[i]);
                    }
                }
                return(View(Model));
            }
            TempData["Success"] = "Inserted Successfully!";
            return(RedirectToAction("CategorySearch"));
        }
        public async Task <IActionResult> Post([FromBody] Category viewModel)
        {
            var created = await _categoryBL.Insert(viewModel);

            return(CreatedAtAction(nameof(GetById), new { id = created.Id }, created));
        }