public async Task CreatePortitionAsync() { PortionModel portitionModel = new PortionModel(); portitionModel.GarnishList = new ObservableCollection <DishModel>(_dishes.Where(x => x.CategoryType == DishCategory.Garnish).Select(x => CreateNewModel(x))); portitionModel.MeatList = new ObservableCollection <DishModel>(_dishes.Where(x => x.CategoryType == DishCategory.Meat).Select(x => CreateNewModel(x))); portitionModel.SaladList = new ObservableCollection <DishModel>(_dishes.Where(x => x.CategoryType == DishCategory.Salad).Select(x => CreateNewModel(x))); portitionModel.BreadList = new ObservableCollection <DishModel>(_dishes.Where(x => x.CategoryType == DishCategory.Bread).Select(x => CreateNewModel(x))); portitionModel.ChangeVisiblePortitionCommand = new Command <PortionModel>(OnChangeVisiblePortitionCommandAsync); portitionModel.ChangeCheckboxIsDuplicateCommand = new Command <PortionModel>(OnChangeCheckboxIsDuplicateCommandAsync); portitionModel.DeletePortionCommand = new Command <PortionModel>(OnDeletePortionCommandAsync); portitionModel.PortionInfo = new OrderDishModel(); portitionModel.PortionInfo.Portition = portitionModel; portitionModel.PriceStr = ((decimal)DishOrderPriceType.UsualPrice).ToString() + PricePostFix; portitionModel.Price = (decimal)DishOrderPriceType.UsualPrice; foreach (var dish in portitionModel.GarnishList) { dish.ChangeCheckboxCommand = new Command <PortionWithCheckDish>(OnChangeCheckboxGarnishCommandAsync); } foreach (var dish in portitionModel.MeatList) { dish.ChangeCheckboxCommand = new Command <PortionWithCheckDish>(OnChangeCheckboxMeatCommandAsync); } foreach (var dish in portitionModel.SaladList) { dish.ChangeCheckboxCommand = new Command <PortionWithCheckDish>(OnChangeCheckboxSaladCommandAsync); } foreach (var dish in portitionModel.BreadList) { dish.ChangeCheckboxCommand = new Command <PortionWithCheckDish>(OnChangeCheckboxBreadCommandAsync); } PortionModels.Add(portitionModel); CalculateTotolPrice(); }