Esempio n. 1
0
 public void OnGet()
 {
     Part       = new PartModel();
     Categories = PartCategoryService.GetAll().Select(a => new SelectListItem
     {
         Value = a.CategoryID.ToString(),
         Text  = a.Title
     });
 }
Esempio n. 2
0
 public void OnGet(int partID)
 {
     Part       = PartService.GetById(partID);
     Categories = PartCategoryService.GetAll().Select(a => new SelectListItem
     {
         Value = a.CategoryID.ToString(),
         Text  = a.Title
     });
 }
Esempio n. 3
0
 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
     });
 }
Esempio n. 4
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"));
        }