Esempio n. 1
0
        public ActionResult EditCategory()
        {
            var im = new NavigationCategoryIM
            {
                Importance = 0,
                Active     = true
            };

            return(View(im));
        }
Esempio n. 2
0
        public async Task <IActionResult> SaveCategory([Bind("Id, Title, Importance, Active")] NavigationCategoryIM im)
        {
            if (!ModelState.IsValid)
            {
                AR.Setfailure(GetModelErrorMessage());
                return(Json(AR));
            }

            var model = _mapper.Map <NavigationCategory>(im);

            model.CreatedDate = DateTime.Now;
            model.CreatedBy   = User.Identity.Name;
            model.IsSys       = false;

            _context.Add(model);

            await _context.SaveChangesAsync();

            // return RedirectToAction(nameof(Index));
            AR.SetSuccess(string.Format(Messages.AlertCreateSuccess, EntityNames.MenuCategory));
            return(Json(AR));
        }