private async Task <TradiureTranscriptionRequest> UpdateStateRepository(TraduireTranscriptionStatus status, HttpStatusCode code, string uri) { state.Value.LastUpdateTime = DateTime.UtcNow; state.Value.Status = status; state.Value.StatusDetails = code.ToString(); state.Value.TranscriptionStatusUri = uri; await state.SaveAsync(); return(new TradiureTranscriptionRequest() { TranscriptionId = state.Value.TranscriptionId, BlobUri = uri }); }
public async Task <ActionResult <ToDoList> > CompleteToDoAsync( [FromState(StoreName)] StateEntry <ToDoList> toDoList, Guid toDoId) { var toDo = toDoList.Value?.ToDos.FirstOrDefault(t => t.Id == toDoId); if (toDo is null) { return(NotFound()); } toDo.Completed = true; await toDoList.SaveAsync(); await _daprClient.PublishEventAsync( "completed", new ToDoItemCompletedEvent { ListId = toDoList.Value.Id, ItemId = toDoId, Title = toDo.Title, Description = toDo.Description }); return(toDoList.Value); }
public async Task <ActionResult <int> > Withdraw([FromState(StateStore)][FromRoute] StateEntry <int?> account, [FromBody] int amount) { account.Value ??= 0; account.Value -= amount; await account.SaveAsync(); return(account.Value); }
public async Task <ActionResult <int> > Deposit([FromRoute] StateEntry <int?> account, [FromBody] int amount) { account.Value ??= 0; account.Value += amount; await account.SaveAsync(); return(account.Value); }
private async Task UpdateStateRepository(TraduireTranscriptionStatus status, HttpStatusCode code) { state = await GetCurrentState(transcriptionRequest.TranscriptionId.ToString()); state.Value ??= new TraduireTranscription(); state.Value.LastUpdateTime = DateTime.UtcNow; state.Value.Status = status; state.Value.StatusDetails = code.ToString(); state.Value.TranscriptionStatusUri = transcriptionRequest.BlobUri; await state.SaveAsync(); }
public async Task <ActionResult <ToDoList> > CreateToDoAsync( [FromState(StoreName)] StateEntry <ToDoList> toDoList, ToDoItem toDo) { if (toDoList.Value is null) { return(NotFound()); } toDo.Id = Guid.NewGuid(); toDoList.Value.ToDos.Add(toDo); await toDoList.SaveAsync(); return(toDoList.Value); }
public IEnumerable <WeatherForecast> Get([FromState("statestore", "counter")] StateEntry <int> currentCount) { currentCount.Value++; currentCount.SaveAsync().Wait(); _logger.LogInformation($"{currentCount.Key}: {currentCount.Value}"); var rng = new Random(); return(Enumerable.Range(1, 5).Select(index => new WeatherForecast { Date = DateTime.Now.AddDays(index), TemperatureC = rng.Next(-20, 55), Summary = Summaries[rng.Next(Summaries.Length)] }) .ToArray()); }
public async Task AddOneWithStateEntryAndCustomKey([FromState("testStore", "widget")] StateEntry <Widget> state) { state.Value.Count++; await state.SaveAsync(); }
public async Task AddOneWithStateEntry([FromState("testStore")] StateEntry <Widget> widget) { widget.Value.Count++; await widget.SaveAsync(); }
public async Task AddOneWithStateEntry(StateEntry <Widget> widget) { widget.Value.Count++; await widget.SaveAsync(); }