public IActionResult AddCategory(Category obj)
 {
     try
     {
         _repo.AddCategory(obj);
         return(Ok());
     }
     catch (Exception ex)
     {
         return(NotFound(ex.InnerException.Message));
     }
 }
 public IActionResult AddCategory(Category category)
 {
     try
     {
         _repo.AddCategory(category);
         return(Ok());
     }
     catch (Exception e)
     {
         return(NotFound(e.Message));
     }
 }
 public IActionResult AddCategories(Category cat)
 {
     try
     {
         _iadrepo.AddCategory(cat);
         return(Ok());
     }
     catch (Exception e)
     {
         return(NotFound(e.InnerException.Message));
     }
 }
        public async Task <bool> AddCategory(CategoryModel obj)
        {
            try
            {
                await _repo.AddCategory(obj);

                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 5
0
        public async Task <IActionResult> AddCategory(Category category)
        {
            if (ModelState.IsValid)
            {
                if (string.IsNullOrEmpty(category.CategoryName))
                {
                    return(BadRequest());
                }

                if (await _repo.AddCategory(category) != null)
                {
                    return(Ok());
                }
            }
            return(BadRequest());
        }
Esempio n. 6
0
        public ActionResult SaveCategory(Category Category)
        {
            if (Request.Form["CategoryId"] == "0")
            {
                _adminRepository.AddCategory(Category);
            }

            else
            {
                _adminRepository.UpdateCategory_1(Category);
            }



            CategoryModel vm = new CategoryModel();

            vm.Categories = _adminRepository.GetAllCategory();
            return(View("ManageCategories", vm));
        }
Esempio n. 7
0
        public async Task <bool> AddCategory(Category obj)
        {
            try
            {
                bool cat = await _repo.AddCategory(obj);

                if (cat == true)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public void Addcategory(Category obj)
 {
     _repo.AddCategory(obj);
 }