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")); }
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")); }