示例#1
0
        public async Task <IActionResult> GetAllRecipes()
        {
            // Synchronous
            //var allRecipes =  _repository.GetAllRecipes();
            //return allRecipes.ToList();

            IEnumerable <Recipe> allRecipes = await _repository.GetAllRecipes();

            var mappedResult = _mapper.Map <IEnumerable <RecipeReadDto> >(allRecipes);

            return(StatusCode(200, new { status = "success", statusCode = 200, message = "Data successfully retrieved!", data = mappedResult }));
        }
示例#2
0
 private void ShowAllRecipes()
 {
     RecipeNames.ReplaceWith(_recipeRepo.GetAllRecipes());
 }