public IAgentEntity Add(IAgentEntity entity) { var collection = _ds.GetCollection <Agent>(); entity.Id = collection.AsQueryable().Max(a => a.Id) + 1; collection.InsertOne((Agent)entity); return(entity); }
public bool Update(IAgentEntity entity) { var collection = _ds.GetCollection <Agent>(); return(collection.UpdateOne(entity.Id, (Agent)entity)); }