public async Task CreatePost(MyProfileViewModel viewModel) { var post = new Post { UserId = viewModel.CreatePost.UserId, Title = viewModel.CreatePost.Title, WallId = viewModel.CreatePost.WallId, Content = viewModel.CreatePost.Content, }; await dbContext.AddAsync(post); await dbContext.SaveChangesAsync(); }
public async Task CreatePost(MyProfileViewModel viewModel) { var post = new Post { UserId = viewModel.CreatePost.UserId, Title = viewModel.CreatePost.Title, Content = viewModel.CreatePost.Content, }; await dbContext.AddAsync(post); try { await dbContext.SaveChangesAsync(); } catch (System.Exception e) { throw e; } }