public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
                await _catalogItemViewModelService.UpdateCatalogItem(CatalogModel);
            }

            return(RedirectToPage("/Admin/Index"));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            ModelState.Remove("CatalogModel.FormImage");
            if (ModelState.IsValid)
            {
                await _catalogItemViewModelService.UpdateCatalogItem(CatalogModel);

                await _catalogNotifications.CatalogItemsNotifyAsync(CatalogModel.Id, CatalogModel.Price);
            }

            return(RedirectToPage("/Admin/Index"));
        }
        public async Task <IActionResult> OnPostAsync()
        {
            if (ModelState.IsValid)
            {
                if (CatalogModel.Image != null)
                {
                    var a        = "http://catalogbaseurltobereplaced/";
                    var fileName = Path.GetFileName(CatalogModel.Image.FileName);
                    var newName  = Guid.NewGuid().ToString("n").Substring(0, 8) + Path.GetExtension(CatalogModel.Image.FileName);
                    var filePath = Path.Combine(_env.WebRootPath, "images\\products", newName);
                    CatalogModel.PictureUri = a + "images/products/" + newName;

                    using (var fileSteam = new FileStream(filePath, FileMode.Create))
                    {
                        await CatalogModel.Image.CopyToAsync(fileSteam);
                    }
                }
                //Thread.Sleep(2000);
                await _catalogItemViewModelService.UpdateCatalogItem(CatalogModel);
            }

            return(RedirectToPage("/Admin/Index"));
        }