public async Task <IActionResult> EditPieDetail(PieDetailCreateViewModel pieDetailCreateViewModel)
        {
            if (ModelState.IsValid)
            {
                await _pieDetailRepository.Update(_mapper.Map <PieDetailCreateViewModel, PieDetail>(pieDetailCreateViewModel));

                //return View(pieDetailCreateViewModel);
            }
            pieDetailCreateViewModel.Albumes  = _flickrRepository.AlbumsOptions();
            pieDetailCreateViewModel.Children = _pieDetailRepository.GetChildren(pieDetailCreateViewModel.PieDetailId);

            return(View(pieDetailCreateViewModel));
        }
Example #2
0
        public IActionResult AddPieDetailChild(int pieDetailId)
        {
            var pieDetail       = _pieDetailRepo.GetPieDetailById(pieDetailId);
            ProductViewModel vm = new ProductViewModel();
            var baseProduct     = _pieDetailRepo.GetChildren(pieDetailId).FirstOrDefault();

            if (baseProduct != null)
            {
                vm.Category        = baseProduct.Category;
                vm.IsActive        = baseProduct.IsActive;
                vm.IsOnSale        = baseProduct.IsOnSale;
                vm.MinOrderAmount  = baseProduct.MinOrderAmount;
                vm.MultipleAmount  = baseProduct.MultipleAmount;
                vm.PreparationTime = baseProduct.PreparationTime;
                vm.Price           = baseProduct.Price;
                vm.PriceInStore    = baseProduct.PriceInStore;
                vm.Temperature     = baseProduct.Temperature;
            }
            vm.PieDetails  = _pieDetailRepo.PieDetails;
            vm.PieDetail   = pieDetail;
            vm.PieDetailId = pieDetail.PieDetailId;
            vm.Ingredients = pieDetail.Ingredients;
            return(View("Product", vm));
        }
 public IEnumerable <Product> GetByParent(int id) => _pieDetailRepository.GetChildren(id);