public bool Update(Post entity) { try { var post = _posts.First(e => e.Id == entity.Id); post.Body = entity.Body; post.Topic = entity.Topic; _dataContext.SubmitChanges(); return true; } catch (Exception) { return false; } }
public int Create(Post entity) { _posts.InsertOnSubmit(entity); _dataContext.SubmitChanges(); return entity.Id; }