Esempio n. 1
0
        public ActionResult Create(CategoryViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                //Toast message
                this.AddToastMessage("", "Error while creating new Category.", ToastType.Error);
                return(View("Create", vm));
            }

            var result = _categoryApplication.Create(vm);


            if (result != null)
            {
                this.AddToastMessage("", "Category created with success.", ToastType.Success);
                return(RedirectToAction("Index"));
            }
            else
            {
                this.AddToastMessage("", "Error while creating new Category.", ToastType.Error);
                return(View("Create", vm));
            }
        }