Exemplo n.º 1
0
        public ActionResult CreateCategory(ComCategoryListViewModel model)
        {
            if (ModelState.IsValid && model != null)
            {
                if (!String.IsNullOrEmpty(model.name))
                {
                    bool result = commonListUnitOfWork.CreateCategory(model.name, model.description);

                    if (result)
                    {
                        TempData["successmessage"] = "Tạo nhóm ngành nghề " + model.name + " thành công.";
                    }
                    else
                    {
                        TempData["errormessage"] = "Tạo nhóm ngành nghề " + model.name + " thất bại!";
                    }
                }
                else
                {
                    TempData["errormessage"] = "Dữ liệu không hợp lệ!";
                }
            }
            else
            {
                TempData["errormessage"] = "Có lỗi xảy ra!";
            }

            return(RedirectToAction("CategoryList"));
        }
Exemplo n.º 2
0
        public ActionResult CategoryList()
        {
            ComCategoryListViewModel model = new ComCategoryListViewModel();

            model.categories = commonListUnitOfWork.CategoryRepository.Get(s => s.IsDeleted == false).OrderBy(s => s.Name).AsEnumerable();
            model.name       = "";

            return(View(model));
        }