public ActionResult GetAllToys() { try { return(Ok(toyRepository.GetAllToys())); } catch (Exception e) { return(BadRequest(e)); } }
public async Task <List <ToyModel> > GetAllToys() { var result = await _toy.GetAllToys(); List <ToyModel> list = new List <ToyModel>(); for (int i = 0; i < result.Count(); i++) { var model = _mapper.Map <ToyModel>(result[i]); list.Add(model); } return(list); }