Beispiel #1
0
        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"));
        }