public async Task <Thootle> CreateThootle(Thootle data) { await _thootles.InsertOneAsync(data); Log.Debug("CRUD CreateThootle Thootle:{@data}", data); return(await Task.FromResult(data)); }
public async Task <ReplaceOneResult> UpdateThootle(string id, Thootle data) { var result = await _thootles.ReplaceOneAsync(GetIdFilter(id), data); Log.Debug("CRUD UpdateThootle Id:{Id}; Thootle:{@Thootle}; Result:{@Result}", id, data, result); return(await Task.FromResult(result)); }
public async Task <ReplaceOneResult> UpdateThootle(Thootle data) { var result = await UpdateThootle(data.Id, data); Log.Debug("CRUD UpdateThootle Thootle:{@Thootle}; Result:{@Result}", data, result); return(await Task.FromResult(result));; }
public DataState(IEnumerable <Thootle> thootles, bool isLoading, string error = null, Thootle stagedThootle = null) { IsLoading = isLoading; Thootles = (thootles?.ToList() ?? new List <Thootle>()).AsReadOnly(); //not sure about this but...idk i feel fancy using ReadOnlyList :( Error = error; StagedThootle = stagedThootle; }
public async Task <int> PostThootleAsync(Thootle thootle) { try { var response = await _httpClient.PostAsJsonAsync($"{_config.Url}/Thootles", thootle); return((int)response.StatusCode); } catch (Exception e) { throw new Exception($"HTTP request for Thootle creation failed!\n{e.Message}"); } }
public async Task UpdateThootleAsync(Thootle thootle) { try { var response = await _httpClient.PutAsJsonAsync($"{_config.Url}/Thootles/{thootle.Id}", thootle); if (!response.IsSuccessStatusCode) { throw new Exception($"Response bad statuscode {response.StatusCode}"); } } catch (System.Exception e) { throw new Exception($"HTTP request for Thootle update failed!\n{e.Message}"); } }
public void Update(Thootle thootle) => _dispatcher.Dispatch(new UpdateAction(thootle));
public void Filter(Thootle filter) { //todo }
public void Create(Thootle thootle) => _dispatcher.Dispatch(new CreateDataAction(thootle));
public void Edit(Thootle thootle) { _dispatcher.Dispatch(new BeginEditAction(thootle)); }
public Task DeleteThootleAsync(Thootle thootle) { return(DeleteThootleAsync(thootle.Id)); }
public UpdateAction(Thootle thootle) { Thootle = thootle; }
public BeginEditAction(Thootle thootle) { Thootle = thootle; }
public CreateDataResultAction(Thootle thootle) { Thootle = thootle; }
public CreateDataAction(Thootle thootle) { Thootle = thootle; }
public Task <DeleteResult> DeleteThootle(Thootle data) { return(DeleteThootle(data.Id)); }
public void Delete(Thootle thootle) { _dispatcher.Dispatch(new DeleteDataAction(thootle.Id)); }