コード例 #1
0
 public void OnGet()
 {
     Part       = new PartModel();
     Categories = PartCategoryService.GetAll().Select(a => new SelectListItem
     {
         Value = a.CategoryID.ToString(),
         Text  = a.Title
     });
 }
コード例 #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
     });
 }
コード例 #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
     });
 }
コード例 #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"));
        }
コード例 #5
0
 public PartCategoryManagementController(PartCategoryService partCategoryService)
 {
     this._partCategoryService = partCategoryService;
 }