public void CascadeRebind(int it, int im, int ib, string st)
 {
     TopModel.rebind(it, st);
     MiddleModel.rebind(im, st, TopModel.SelectedValue);
     BottomModel.rebind(ib, st, TopModel.SelectedValue, MiddleModel.SelectedValue);
     setFeedback();
 }
        public static void RemoveBottom(BottomModel model)
        {
            UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository();
            var bottom = BottomFactory.ConvertBottom(model);

            unitOfWork.BottomRepository.RemoveBottom(bottom.Id);
        }
        public static BottomModel AddBottom(BottomModel model)
        {
            UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository();

            model.Id = Guid.NewGuid();
            unitOfWork.BottomRepository.AddBottom(BottomFactory.ConvertBottom(model));
            return(model);
        }
        public static BottomModel ApplySauce(BottomModel model, SauceModel smodel)
        {
            UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository();

            model.Sauce = smodel;
            var bottom = BottomFactory.ConvertBottom(model);

            unitOfWork.BottomRepository.AddOrUpdate(bottom);
            return(model);
        }
 public void MiddleSelected(params string[] dependants)
 {
     if (MiddleModel.SelectedIndex <= 0)
     {
         BottomModel.clear();
     }
     else
     {
         BottomModel.bind(dependants);
     }
     setFeedback();
 }
 public void TopSelected(params string[] dependants)
 {
     if (TopModel.SelectedIndex <= 0)
     {
         MiddleModel.clear();
     }
     else
     {
         MiddleModel.bind(dependants);
     }
     BottomModel.clear();
     setFeedback();
 }
        public static PizzaModel AssignBottomToPizza(PizzaModel model, BottomModel bottom, SauceModel sauce)
        {
            if (model == null || bottom == null || sauce == null)
            {
                return(null);
            }

            UnitOfWorkRepository unitOfWork = new UnitOfWorkRepository();

            bottom.Sauce = sauce;
            model.Bottom = bottom;

            unitOfWork.PizzaRepository.UpdatePizza(PizzaFactory.ConvertPizzaModel(model));
            return(model);
        }
Beispiel #8
0
        public static Bottom ConvertBottom(BottomModel model)
        {
            if (model == null)
            {
                return(null);
            }

            Bottom bottom = new Bottom()
            {
                Id      = model.Id,
                Name    = model.Name,
                Price   = model.Price,
                Thick   = model.Thick,
                Surface = model.Surface,
            };

            return(bottom);
        }
        public static BottomModel ConvertBottom(Bottom bottom)
        {
            if (bottom == null)
            {
                return(null);
            }
            var sauceModel = SauceModelFactory.GetSauce(bottom.SauceId);

            BottomModel model = new BottomModel()
            {
                Id      = bottom.Id,
                Sauce   = sauceModel,
                Price   = bottom.Price,
                Surface = bottom.Surface,
                Thick   = bottom.Thick,
                Name    = bottom.Name,
            };

            return(model);
        }
 private void setFeedback()
 {
     TopModel.SetFeedback();
     MiddleModel.SetFeedback();
     BottomModel.SetFeedback();
 }
 private void clearAll()
 {
     TopModel.clear();
     MiddleModel.clear();
     BottomModel.clear();
 }
 public ActionResult AddBottom(BottomModel model)
 {
     BottomManager.AddBottom(model);
     return(RedirectToAction("ManageBottoms"));
 }
 public ActionResult BottomDelete(BottomModel model)
 {
     BottomManager.RemoveBottom(model);
     return(RedirectToAction("ManageBottoms"));
 }
 public ActionResult BottomDetails(BottomModel model)
 {
     return(View(model));
 }