public void OnGet() { Part = new PartModel(); Categories = PartCategoryService.GetAll().Select(a => new SelectListItem { Value = a.CategoryID.ToString(), Text = a.Title }); }
public void OnGet(int partID) { Part = PartService.GetById(partID); Categories = PartCategoryService.GetAll().Select(a => new SelectListItem { Value = a.CategoryID.ToString(), Text = a.Title }); }
public void OnGet() { List = PartService.GetAll(CategoryID); Categories = PartCategoryService.GetAll().Select(a => new SelectListItem { Value = a.CategoryID.ToString(), Text = a.Title, Selected = CategoryID == a.CategoryID }); }
public IActionResult OnPost(PartModel part) { if (!ModelState.IsValid) { Categories = PartCategoryService.GetAll().Select(a => new SelectListItem { Value = a.CategoryID.ToString(), Text = a.Title, Selected = part.CategoryID == a.CategoryID }); return(Page()); } PartService.New(part); return(RedirectToPage("/Parts/Index")); }