public async Task RemoveById(int id) { var post = new Enities.Post() { Id = id }; _cmsDbContext.Posts.Attach(post); _cmsDbContext.Posts.Remove(post); await _cmsDbContext.SaveChangesAsync(); }
public async Task <Core.Domain.Post> Add(Core.Domain.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 Core.Domain.Post { Content = post.Content, ModifiedDate = post.ModifiedDate, Title = post.Title, CreatedDate = post.CreatedDate, Id = post.Id }); }