Beispiel #1
0
        public ActionResult <MealCreateDto> CreateMeal(MealCreateDto MealCreateDto)
        {
            var MealModel = _mapper.Map <Meal>(MealCreateDto);

            _repository.CreateMeal(MealModel);
            _repository.SaveChanges();

            var MealReadDto = _mapper.Map <MealReadDto>(MealModel);

            //return Ok(MealReadDto);
            return(CreatedAtRoute(nameof(GetMealById), new { Id = MealReadDto.Id }, MealReadDto));
        }