public async Task <IEnumerable <IngredientDto> > GetAllAsync() { var ingredients = await _ingredientRepository.GetAll(); var dtoIngredients = _mapper.Map <IEnumerable <Ingredient>, IEnumerable <IngredientDto> >(ingredients); return(dtoIngredients); }
public List <Ingredient> GetMedicineIngredients(Medicine medicine) { List <Ingredient> ingredientsList = new List <Ingredient>(); foreach (Ingredient ingredient in _ingredientFileRepository.GetAll()) { if (medicine.IngredientsList.Contains(ingredient)) { ingredientsList.Add(ingredient); } } return(ingredientsList); }
public void Load() { Ingredients.Clear(); var ingredients = _ingredientRepository.GetAll(); Ingredients.AddRange(ingredients); }
public Task <IEnumerable <Ingredient> > GetAll() { return(Task.Run(() => { return _repository.GetAll(); })); }
public IActionResult GetIngredientsForFood(Guid foodId) { if (_foodRepository.GetSingle(foodId) == null) { return(NotFound()); } var allItems = _repository .GetAll() .Where(x => x.FoodItem.Id == foodId) .ToList(); IEnumerable <IngredientDto> viewModels = allItems .Select(x => Mapper.Map <IngredientDto>(x)); return(Ok(viewModels)); }
private void ShowIngridients() { var ingridients = _ingredientRepository.GetAll(); foreach (var ingridient in ingridients) { Console.WriteLine($"{ingridient.Id} - {ingridient.Name}"); } }
public IEnumerable <Drug> GetAllEager() { IEnumerable <Drug> drugs = this.GetAll(); IEnumerable <Ingredient> ingredients = _ingredientRepository.GetAll(); BindDrugIngredients(drugs, ingredients); BindAlternativeDrugs(drugs); return(drugs); }
public IEnumerable <Allergy> GetAllEager() { IEnumerable <Allergy> allergies = GetAll(); IEnumerable <Ingredient> ingredients = _ingredientsRepository.GetAll(); IEnumerable <Symptom> symptoms = _symptomsRepository.GetAll(); Bind(allergies, ingredients, symptoms); return(allergies); }
public ActionResult <Ingredient> GetAll() { var Ingredient = _contentRepository.GetAll(); if (Ingredient == null) { return(NotFound()); } return(Ok(new { Ingredient = Ingredient })); }
public List <CommonNameDTO> GetAll() { var ingredients = _ingredientRepository.GetAll(); var ingredientDtos = new List <CommonNameDTO>(); foreach (var item in ingredients) { ingredientDtos.Add(new CommonNameDTO { Name = item.Name, NameForeign = item.NameForeign }); } return(ingredientDtos); }
public IEnumerable <LookupItem> GetAllIngredients() { var allIngredients = _ingredientRepository.GetAll(); var ingredientLookups = new List <LookupItem>(); foreach (var ingredient in allIngredients) { ingredientLookups.Add(new LookupItem() { Id = ingredient.Id, DisplayMember = ingredient.Name }); } return(ingredientLookups); }
public IEnumerable <Ingredient> GetAll() { return(_ingredientRepo.GetAll()); }
// GET: Ingredients public async Task <IActionResult> Index() { return(View(await _ingredientRepo.GetAll())); }
public async Task <IList <IngredientLogic> > GetAll() { return(_mapper.Map <List <IngredientLogic> >(await _ingredientRepository.GetAll())); }
public IEnumerable <Ingredient> Get() { return(_ingredientRepository.GetAll().ToList()); }
public ActionResult MakeABurger(MakeABurgerPostViewModel makeABurgerPostViewModel) { User currentUserDb = userRepository.GetAll(x => x.Id == LoginUserSession.Current.UserId).FirstOrDefault(); if (!ModelState.IsValid) { TempData["ErrorMessage"] = ModelState.Where(x => x.Value.Errors.Count > 0).FirstOrDefault().Value.Errors.FirstOrDefault().ErrorMessage; return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); } if (currentUserDb == null) { return(RedirectToAction("Login", "Home")); } if (makeABurgerPostViewModel.ChosenBunId <= 0) { TempData["ErrorMessage"] = "Please select a bun type"; return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); } if (makeABurgerPostViewModel.ChosenIngredientsIds.Count == 0) { TempData["ErrorMessage"] = "Please select at least 1 ingredient for the burger"; return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); } if (currentUserDb.Burgers.Any(x => x.Name == makeABurgerPostViewModel.BurgerName)) { TempData["ErrorMessage"] = "You have already created a burger with this name!"; return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); } List <Ingredient> chosenIngredients = new List <Ingredient>(); makeABurgerPostViewModel.ChosenIngredientsIds.ForEach(x => chosenIngredients.Add(ingredientRepository.GetAll(c => c.Id == x).FirstOrDefault())); Bun chosenBun = bunRepository.GetAll(x => x.Id == makeABurgerPostViewModel.ChosenBunId).FirstOrDefault(); currentUserDb.Burgers.Add(new Burger { Name = makeABurgerPostViewModel.BurgerName, Ingredients = chosenIngredients, Bun = chosenBun }); bool isSaved = dbContext.SaveChanges() > 0; if (isSaved) { TempData["SuccessMessage"] = "Burger created successfully"; } else { TempData["ErrorMessage"] = "Ooops something went wrong"; } return(Redirect(ControllerContext.HttpContext.Request.UrlReferrer.ToString())); }
//[Authorize(Policy = PermissionsList.PermissionsIngredientIngredients)] public IActionResult GetIngredients() { return(Ok(new { ingredients = _ingredientRepository.GetAll() })); }
public IEnumerable <Ingredient> GetAll() { var ingredients = _ingredientRepository.GetAll(); return(ingredients); }
public IActionResult GetAll() { var ingredients = _ingredientRepository.GetAll(); return(Ok(ingredients)); }
public IList <Ingredient> GetIngredients() { return(_ingredientRepository.GetAll()); }
public async Task <ActionResult> GetAll() { var ingredientList = await _ingredientRepository.GetAll(); return(StatusCode(200, ingredientList)); }
public void Load() { Ingredients = repository.GetAll() .ToList(); }
private void Bind(IEnumerable <Medicine> medicine) { BindMedicineWithDisease(medicine, _diseaseRepository.GetAll()); BindMedicineWithIngredients(medicine, _ingredientRepository.GetAll()); }
public Task GetIngredients() { var ingredients = _ingredientRepository.GetAll().Result; return(Clients.All.SendAsync("GetIngredients", ingredients)); }