コード例 #1
0
        public async Task <IActionResult> AddBouqetToStore(int storeId, BouqetUpsertInput input)
        {
            _logger.LogInformation($"Creating a bouqet for store {storeId}");
            try
            {
                var persistedBouqet = await _bouquetRepository.Insert(storeId, input.Name, input.Price, input.Description);

                return(Created($"/stores/{storeId}/bouqets/{persistedBouqet.Id}", persistedBouqet.Convert()));
            }
            catch (NotFoundException)
            {
                return(NotFound());
            }
        }
コード例 #2
0
        public async Task <IActionResult> UpdateBouqetToStore(int storeId, int bouqetId, BouqetUpsertInput input)
        {
            _logger.LogInformation($"Updating bouqet {bouqetId} for store {storeId}");
            try
            {
                await _bouquetRepository.Update(storeId, bouqetId, input.Name, input.Price);

                return(Accepted());
            }
            catch (NotFoundException)
            {
                return(NotFound());
            }
        }