public async Task <IActionResult> OnPostAsync() { await Init(); if (!ModelState.IsValid) { return(Page()); } Article.Category = await _articleCategoryService.GetArticleCategoryAsync(Article.CategoryId); if (ImageUpload != null) { Article.ImageFileName = await _articleService.UploadArticleImageAsync(ImageUpload); } await _articleService.CreateArticleAsync(Article); return(RedirectToPage("/Index")); }