示例#1
0
        public async Task <BlogSub> AddBlogSubAsync(BlogSub blogSub)
        {
            await _dataContext.BlogSubs.AddAsync(blogSub);

            await _dataContext.SaveChangesAsync();

            return(blogSub);
        }
示例#2
0
        public async Task <IActionResult> OnPost()
        {
            BlogSub blogSub = new BlogSub()
            {
                Subtitle = ViewModel.SubTitle,
                Details  = ViewModel.SubDetails,
                BlogId   = Id
            };

            _ = await _blogService.AddBlogSubAsync(blogSub);

            return(RedirectToPage());
        }