Skip to content

Instantly share code, notes, and snippets.

@mortezadalil
Created December 8, 2019 11:05
Show Gist options
  • Save mortezadalil/b430ace6a33044542e6b978e175547f5 to your computer and use it in GitHub Desktop.
Save mortezadalil/b430ace6a33044542e6b978e175547f5 to your computer and use it in GitHub Desktop.
public async Task<Post> Add(Post domain)
{
var post = new Enities.Post
{
Title = domain.Title,
CreatedDate = domain.CreatedDate,
ModifiedDate = domain.ModifiedDate,
Content = domain.Content
};
await _cmsDbContext.Posts.AddAsync(post);
await _cmsDbContext.SaveChangesAsync();
return new Post
{
Content = post.Content,
ModifiedDate = post.ModifiedDate,
Title = post.Title,
CreatedDate = post.CreatedDate,
Id = post.Id
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment