public async Task <List <RecipeViewModel> > GetAllRecipes(string cuisineCode) { List <RecipeDTO> data = await _rc.GetDataAsync <List <RecipeDTO> >(GetActionMethods.Receipts, cuisineCode); List <RecipeViewModel> recipes = new List <RecipeViewModel>(); foreach (var item in data) { recipes.Add(new RecipeViewModel() { ID = item.ID, Image = item.Image, TimeToCook = item.TimeToCook, Title = item.Title, Portions = item.Portions }); } return(recipes); }
public async Task <List <CookerViewModel> > GetCookers(string cuisineCode) { List <CookerDTO> data = await _rc.GetDataAsync <List <CookerDTO> >(GetActionMethods.Cookers, cuisineCode); List <CookerViewModel> cookers = new List <CookerViewModel>(); foreach (var item in data) { cookers.Add(new CookerViewModel() { ID = item.ID, Description = item.Description, HoursPricing = item.HoursPricing, Image = item.Image, Name = string.Format("{0} {1}", item.FirstName, item.LastName), OrdersCount = item.OrdersCount, Rating = item.Rating }); } return(cookers); }
public async Task <CookerViewModel> GetCooker(int cookerID) { CookerDTO data = await _rc.GetDataAsync <CookerDTO>(GetActionMethods.Cooker, string.Format("{0}?fromDate={1}", cookerID, DateTime.Now.ToString("yyyy-MM-dd"))); return(new CookerViewModel() { ID = data.ID, Description = data.Description, HoursPricing = data.HoursPricing, Image = data.Image, Name = string.Format("{0} {1}", data.FirstName, data.LastName), OrdersCount = data.OrdersCount, Rating = data.Rating }); }