示例#1
0
        public IActionResult Edit(String id)
        {
            if (String.IsNullOrEmpty(id))
            {
                return(RedirectToAction("Create"));
            }

            var model = new CategoriesCreateEditModel(id);

            return(View("CreateEdit", model));
        }
示例#2
0
        private IActionResult createEditForHtmlForm(CategoriesCreateEditModel model)
        {
            if (ModelState.IsValid)
            {
                var error = model.CreateEdit();

                if (error != null)
                {
                    ModelState.AddModelError("Category.Name", HttpContext.Translate(error));
                }
            }

            if (ModelState.IsValid)
            {
                return(RedirectToAction("Index"));
            }

            return(View("CreateEdit", model));
        }
示例#3
0
 public IActionResult Edit(String id, CategoriesCreateEditModel model)
 {
     model.Type = OperationType.Edition;
     return(createEditForHtmlForm(model));
 }
示例#4
0
        public IActionResult Create(CategoriesCreateEditModel model)
        {
            model.Type = OperationType.Creation;

            return(createEditForHtmlForm(model));
        }
示例#5
0
        public IActionResult Create()
        {
            var model = new CategoriesCreateEditModel();

            return(View("CreateEdit", model));
        }