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")); }
// 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)); }