Esempio n. 1
0
        public async Task <TDto> CreateAsync <TDto>(FoodManage dto)
            where TDto : class, IFoodViewable
        {
            var food = mapper.Map <Food>(dto);

            await CreateAsync(food);

            return(mapper.Map <TDto>(food));
        }
Esempio n. 2
0
        public async Task <IActionResult> UpdateAsync([FromBody] FoodManage dto)
        {
            try
            {
                await foodService.CreateAsync(dto);

                return(Ok());
            }
            catch (EntityNotFoundException <Food> )
            {
                return(NoContent());
            }
            catch (Exception)
            {
                return(BadRequest());
            }
        }
Esempio n. 3
0
        public async Task CreateAsync(FoodManage dto)
        {
            var food = mapper.Map <Food>(dto);

            await CreateAsync(food);
        }