public IActionResult AddPost(PostViewModel model) { Post ToBeAdded = new Post(model.UserName, model.Content, model.CommentOfId); _ctx.Posts.Add(ToBeAdded); _ctx.SaveChanges(); return(Ok()); }
public T Add(T entity) { context.Set <T>().Add(entity); context.SaveChanges(); return(entity); }