コード例 #1
0
        public async Task <Guid> CreateDish(DishCreationDto dishCreationDto)
        {
            var dish = Mapper.Map <Dish>(dishCreationDto);
            await _dishesRepository.AddAsync(dish);

            await UnitOfWork.CommitAsync();

            var file = await _filesRepository.GetByIdAsync(dish.FileId);

            await _fileSystemService.MoveFileAsync(file.Name, "dishes");

            return(dish.Id);
        }
コード例 #2
0
        public async Task <IActionResult> Post(DishCreationDto dishCreationDto)
        {
            var result = await _dishesService.CreateDish(dishCreationDto);

            return(Ok(result));
        }