public async Task <UpdateResult> Update(CommandEntity command) { var update = new UpdateDefinitionBuilder <CommandEntity>() .Set(x => x.Description, command.Description) .Set(x => x.Name, command.Name) .Set(x => x.UpdatedBy, command.UpdatedBy) .Set(x => x.LastUpdated, DateTime.Now); return(await _commandsCollection.UpdateOneAsync(x => x.Id == command.Id, update)); }
public async Task Create(CommandEntity command) { command.Created = DateTime.Now; command.Deleted = false; await _commandsCollection.InsertOneAsync(command); }
public async Task Put([FromBody] CommandEntity entity) { await _commandsRepo.Update(entity); }
public async Task Post([FromBody] CommandEntity entity) { await _commandsRepo.Create(entity); }