public void Post(WallEntry wallEntry) { DiscardNullObject(wallEntry); lock (_repo) { _repo.Add(wallEntry); } }
public void Put(WallEntry wallEntry) { DiscardNullObject(wallEntry); lock (_repo) { CheckIfExistsInRepo(wallEntry.Id); ReplaceIitemsInRepo(wallEntry); } }
private void ReplaceIitemsInRepo(WallEntry wallEntry) { var indexes = _repo.Where(q => q.Id == wallEntry.Id).Select(q => _repo.IndexOf(q)).ToArray(); foreach (var index in indexes) { _repo[index] = wallEntry; } }
public async Task DeleteAsync(WallEntry wallEntry) { var response = await _httpClient.DeleteAsync(wallEntry.Id.ToString()); }
public async Task UpdateAsync(WallEntry wallEntry) { var response = await _httpClient.PutAsJsonAsync("", wallEntry); }
public async Task SaveAsync(WallEntry wallEntry) { var response = await _httpClient.PostAsJsonAsync("", wallEntry); }