Ejemplo n.º 1
0
        public override async Task OnActivateAsync()
        {
            await using (var connection = dbConnectionFactory.CreateConnection()) {
                await connection.OpenAsync();

                var value = await connection.GetAsync <TodoRecord>(this.GetPrimaryKey().ToString());

                this.record = value;
            }
        }
Ejemplo n.º 2
0
        public async Task Patch(TodoRecord newValue)
        {
            if (this.record.AssigneeId != null && newValue.AssigneeId != null && this.record.AssigneeId != newValue.AssigneeId)
            {
                throw new HttpResponseException(HttpStatusCode.BadRequest, "This todo has already been assigned to someone.");
            }
            logger.LogInformation(newValue.Description);
            await using (var connection = dbConnectionFactory.CreateConnection()) {
                await connection.OpenAsync();

                await connection.UpdateAsync <TodoRecord>(newValue);
            }
        }
Ejemplo n.º 3
0
 public async Task Patch(Guid id, [FromBody] TodoRecord input)
 {
     this.logger.LogInformation(input.ToString());
     var grain = clusterClient.GetGrain <ITodoGrain>(id);
     await grain.Patch(input);
 }