Exemple #1
0
        public IActionResult Save(UserTypeIndexViewModel model)
        {
            var userId = int.Parse(HttpContext.Session.GetString("UserId"));

            if (ModelState.IsValid)
            {
                var item = new UserType();
                item.Id          = model.Item.Id;
                item.Description = model.Item.Description;
                _Services.Save(item, userId);
            }
            return(RedirectToAction("Index"));
        }
Exemple #2
0
        // GET: /<controller>/
        public IActionResult Index()
        {
            var result = _Services.UserTypes()
                         .Select(a => new UserTypeItem
            {
                Id          = a.Id,
                Description = a.Description,
            }).ToList();
            var model = new UserTypeIndexViewModel
            {
                UserTypes = result,
            };

            return(View(model));
        }