/// <summary> /// update the product /// </summary> /// <returns>the admin page</returns> public async Task <IActionResult> OnPost() { var pro = await _product.GetProduct(ID.GetValueOrDefault()) ?? new Product(); // set the data from the database to the new data from admin input pro.Name = Product.Name; pro.ImageURL = Product.ImageURL; pro.Price = Product.Price; pro.Sku = Product.Sku; // Save the product in the database await _product.UpdateProduct(pro); return(RedirectToPage("Admin")); }