public IActionResult OnGet(int productId) { Product = productsData.GetById(productId); if (Product == null) { return(RedirectToPage("NotFound")); } else { return(Page()); } }
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()); } }
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()); } }
public Product Get(int id) { return(productsData.GetById(id)); }