internal void Remove(ToDoItem match) { if(match!=null && match.CreatedBy.Equals(this._userName, StringComparison.OrdinalIgnoreCase)) { _collection.DeleteOne(c => c.Id == match.Id); } }
public void Add(ToDoItem item) { if (item != null) { var guid= Guid.NewGuid(); item.Id = guid; _todoItems.TryAdd(guid, item); } }
internal void Update(ToDoItem item) { var update = Builders<ToDoItem>.Update.Set(nameof(item.Title), item.Title) .Set(nameof(item.Description), item.Description) .Set(nameof(item.IsComplete), item.IsComplete) .Set(nameof(item.UpdatedBy), item.UpdatedBy) .Set(nameof(item.UpdatedDate), item.UpdatedDate); _collection.UpdateOne<ToDoItem>(c => c.Id == item.Id && c.CreatedBy.Equals(this._userName, StringComparison.OrdinalIgnoreCase), update); }
public void Update(ToDoItem item) { ToDoItem match = null; _todoItems.TryGetValue(item.Id, out match); if (match != null && match.CreatedBy.Equals(this._userName, StringComparison.OrdinalIgnoreCase)) { match.Description = item.Description; match.Title = item.Title; match.IsComplete = item.IsComplete; match.UpdatedBy = this._userName; match.UpdatedDate = DateTime.Now; _todoItems[item.Id] = match; } }
public void Update(ToDoItem item) { _context.Update(item); }
public void Add(ToDoItem item) { _context.Add(item); }
public void Update(ToDoItem item) { _context.Update(item); _context.SaveChanges(); }
public void Add(ToDoItem item) { _context.Add(item); _context.SaveChanges(); }
internal void Add(ToDoItem item) { _collection.InsertOne(item); }