Exemplo n.º 1
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            ShopItem.Image = await azureService.UploadFileToBlob(FileManager.FormFile);

            ShopItem.SupplierId = _userManager.GetUserId(User);

            await itemService.CreateItem(ShopItem);

            return(RedirectToPage("./Items"));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> OnPostAsync()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            try
            {
                ShopItem.Image = await azureService.UploadFileToBlob(FileManager.FormFile);

                await itemService.UpdateItem(ShopItem);
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(RedirectToPage("./Items"));
        }