Esempio n. 1
0
 // GET: Recipes/Create
 public IActionResult Create()
 {
     ViewData["ApplicationUserId"] = new SelectList(usersRepository.GetAllUsers(), "Id", "Id");
     return(View(new CreateRecipeViewModel()
     {
         AllTags = tagsRepository.GetAllTags().Select(tag => new SelectListItem()
         {
             Text = tag.Name, Value = tag.Id.ToString()
         }),
         AllIngredients = ingredientsRepository.GetAllIngredients().Select(ing => new SelectListItem()
         {
             Text = $"{ing.Name} {ing.Unit}", Value = ing.Id.ToString()
         })
     }
                 ));
 }
Esempio n. 2
0
 public async Task <IEnumerable <Tags> > GetAll()
 {
     return(await _tagsRepository.GetAllTags());
 }
Esempio n. 3
0
 public IEnumerable <TagDTO> GetAllTags()
 {
     return(_mapper.Map <IEnumerable <Tag>, IEnumerable <TagDTO> >(_tagsRepository.GetAllTags()));
 }