コード例 #1
0
 public IActionResult OnGet(int productId)
 {
     Product = productsData.GetById(productId);
     if (Product == null)
     {
         return(RedirectToPage("NotFound"));
     }
     else
     {
         return(Page());
     }
 }
コード例 #2
0
        public IActionResult OnGet(int?productId)
        {
            GetAvailableParentsAsSelectListItem();

            if (productId.HasValue)
            {
                Product = productsData.GetById(productId.Value);
                if (Product.ParentId.HasValue)
                {
                    SelectedParentId = Product.ParentId.Value;
                }
            }
            else
            {
                Product = new Product();
            }

            if (Product == null)
            {
                return(RedirectToPage("NotFound"));
            }
            else
            {
                return(Page());
            }
        }
コード例 #3
0
        public IActionResult OnGet(int productId)
        {
            PicturesPath    = configuration.GetValue <string>("UploadPaths:Pictures");
            AttachmentsPath = configuration.GetValue <string>("UploadPaths:Attachments");

            Product = productsData.GetById(productId);

            if (Product == null)
            {
                return(RedirectToPage("NotFound"));
            }
            else
            {
                Pictures      = productsData.GetProductPicturesURLs(productId, PicturesPath);
                Attachments   = productsData.GetProductAttachmentsURLs(productId, AttachmentsPath);
                ChildProducts = productsData.GetChilds(productId);

                return(Page());
            }
        }
コード例 #4
0
 public Product Get(int id)
 {
     return(productsData.GetById(id));
 }