public async Task <(List <Todo> Response, bool Success, Exception Error)> DeleteTodo(Todo todo) { todo.MarkedForDelete = true; var httpResult = await HttpService.Post <Dictionary <Guid, int> >($"{todoBase}/AddOrUpdate", todo); if (httpResult.Success) { await this.SqliteDb.DeleteByCorrelationID <Todo>(todo.CorrelationID); } else { todo.MarkedForDelete = true; await this.SqliteDb.AddOrUpdate <Todo>(todo); } return(await this.SqliteDb.GetByQuery <Todo>(x => x.MarkedForDelete == false)); }
public async Task <(Todo todo, bool success, Exception error)> AddOrUpdateTodo(Todo todo) { Exception ex = null; var httpResult = await HttpService.Post <Dictionary <Guid, int> >($"{todoBase}/AddOrUpdate", todo); httpResult.Error?.LogException("TodoBusinessLogic - AddOrUpdateTodo"); ex = httpResult.Error; if (httpResult.Success) { todo.Id = httpResult.Response.First().Value; } var dbResult = await this.SqliteDb.AddOrUpdate <Todo>(todo); dbResult.Error?.LogException("TodoBusinessLogic - AddOrUpdateTodo"); ex = dbResult.Error; return(todo, ex != null ? false : true, ex); }