public IDataResult <Ingredients> Get(int id) { var result = _ingredientRepository.Get(x => x.Id == id); if (result == null) { return(new ErrorDataResult <Ingredients>(Messages.IngredientNotFound)); } return(new SuccessDataResult <Ingredients>(result)); }
public ActionResult <Ingredient> Get(int id) { var Ingredient = _contentRepository.Get(id); if (Ingredient == null) { return(NotFound()); } return(Ingredient); }
public async Task <IngredientDto> GetAsync(int id) { var ingredient = await _ingredientRepository.Get(id); if (ingredient == null) { throw new NotFoundException("Ingredient not found."); } var dtoIngredient = _mapper.Map <IngredientDto>(ingredient); return(dtoIngredient); }
// GET: Ingredients/Details/id public async Task <IActionResult> Details(Guid?id) { if (id == null) { return(NotFound()); } Ingredient ingredient = await _ingredientRepo.Get((Guid)id); if (ingredient == null) { return(NotFound()); } return(View(ingredient)); }
public Task <Ingredient> Get(int id) { return(Task.Run(() => { return _repository.Get(id); })); }
public async Task EditIngredient(EditIngredientRequestModel editIngredient) { var ingredientToUpdate = await _ingredientRepository.Get(editIngredient.Id); if (ingredientToUpdate != null) { ingredientToUpdate.MeasurmentId = editIngredient.MeasurmentId; ingredientToUpdate.Title = editIngredient.Title; await _ingredientRepository.Edit(ingredientToUpdate); } }
public Drug GetEager(long id) { Drug drug = base.Get(id); foreach (Ingredient ingredient in drug.Ingredients) { Ingredient temp = _ingredientRepository.Get(ingredient.Id); ingredient.Name = temp.Name; ingredient.Quantity = temp.Quantity; } foreach (Drug alternativeDrug in drug.Alternative) { Drug temp = base.Get(id); alternativeDrug.Name = temp.Name; alternativeDrug.Amount = temp.Amount; alternativeDrug.Approved = temp.Approved; } return(drug); }
private async Task <Either <string, Ingredient> > RetrieveIngredient(int id) => (await _ingredientRepository.Get(id)) .ToEither($"Nao foi encontrado um ingrediente com id {id}");
public Ingredient Get(int id) { return(_ingredientRepo.Get(id)); }
public async Task <IngredientLogic> Get(int id) { return(_mapper.Map <IngredientLogic>(await _ingredientRepository.Get(id))); }
public Ingredient Get(int id) { return(ingredientRepository.Get(id)); }
private async Task <Either <Ingredient, Unit> > Validate(CreateIngredient command) => (await _ingredientRepository.Get(command.Name)) .ToEither(new Unit()) .Swap();
public Ingredient Get(long id) { return(_ingrerdientRepository.Get(id)); }
public async Task <IList <Ingredient> > Handle() => await _ingredientRepository.Get();