Beispiel #1
0
        public async Task <Thootle> CreateThootle(Thootle data)
        {
            await _thootles.InsertOneAsync(data);

            Log.Debug("CRUD CreateThootle Thootle:{@data}", data);
            return(await Task.FromResult(data));
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        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));;
        }
Beispiel #4
0
 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;
 }
Beispiel #5
0
        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}");
            }
        }
Beispiel #6
0
        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));
Beispiel #10
0
 public void Edit(Thootle thootle)
 {
     _dispatcher.Dispatch(new BeginEditAction(thootle));
 }
Beispiel #11
0
 public Task DeleteThootleAsync(Thootle thootle)
 {
     return(DeleteThootleAsync(thootle.Id));
 }
Beispiel #12
0
 public UpdateAction(Thootle thootle)
 {
     Thootle = thootle;
 }
Beispiel #13
0
 public BeginEditAction(Thootle thootle)
 {
     Thootle = thootle;
 }
Beispiel #14
0
 public CreateDataResultAction(Thootle thootle)
 {
     Thootle = thootle;
 }
Beispiel #15
0
 public CreateDataAction(Thootle thootle)
 {
     Thootle = thootle;
 }
Beispiel #16
0
 public Task <DeleteResult> DeleteThootle(Thootle data)
 {
     return(DeleteThootle(data.Id));
 }
Beispiel #17
0
 public void Delete(Thootle thootle)
 {
     _dispatcher.Dispatch(new DeleteDataAction(thootle.Id));
 }