public async Task <int> Update(UpdateCoffeeRatingDto coffeeRating) { var sql = @"UPDATE Rating SET comment = @Comment, rating = @Rating WHERE Id = @Id;"; await ThrowExceptionIfCoffeeRatingDoesNotExist(coffeeRating.Id); using (var conn = sqlServerConnectionProvider.GetDbConnection()) { return(await conn.ExecuteAsync(sql, new { coffeeRating.Id, coffeeRating.Comment, coffeeRating.Rating })); } }
public async Task <IActionResult> UpdateRating(int coffeeRatingId, UpdateCoffeeRatingDto updateCoffeeRating) { return(await mediator.Send(new UpdateCoffeeRatingCommand(coffeeRatingId, updateCoffeeRating))); }
public UpdateCoffeeRatingCommand(int coffeeRatingId, UpdateCoffeeRatingDto updateCoffeeRating) { this.CoffeeRatingId = coffeeRatingId; this.UpdateCoffeeRating = updateCoffeeRating; }