public async Task <DishwasherEntity> GetByUserAsync(string userId) { var table = await this.DbClient.GetTableAsync(TableName); var operation = TableOperation.Retrieve <DishwasherEntity>(DishwasherEntity.ToPartitionKey(userId), DishwasherEntity.ToRowKey(userId)); var result = await table.ExecuteAsync(operation); var dishwasher = result.Result as DishwasherEntity ?? new DishwasherEntity { Status = new UnknownStatus() }; return(dishwasher); }
public async Task UpdateStatusAsync(string userId, Status status) { // update var dishwasher = new DishwasherEntity(userId) { Status = status }; // persist var table = await this.DbClient.GetTableAsync(TableName); var operation = TableOperation.InsertOrMerge(dishwasher); await table.ExecuteAsync(operation); }
public async Task <DishwasherEntity> AddAsync(DishwasherEntity entity) { if (entity == null) { throw new ArgumentNullException(nameof(entity)); } var table = await this.DbClient.GetTableAsync(TableName); var operation = TableOperation.Insert(entity); var result = await table.ExecuteAsync(operation); return(result.Result as DishwasherEntity); }
public async Task <DishwasherEntity> AddAsync(DishwasherEntity entity) => await this._repository.AddAsync(entity);