Exemplo n.º 1
0
        public static C.FoodOption ToContract(this VendorFoodOption data)
        {
            if (data == null)
                return null;

            var model = new C.FoodOption()
            {
                Name = data.Name,
                Description = data.Description,
                FoodOptionId = data.VendorFoodOptionId,
                Cost = data.Cost,
                Price = data.Price,
                VendorId = data.OrganizationId
            };

            return model;
        }
Exemplo n.º 2
0
        public ActionResult Save(FoodOption model)
        {
            SaveFoodOptionResponse resp = _vendorMgr.SaveFoodOption(new SaveFoodOptionRequest { Subject = model });

            if (resp.Status == Status.Success)
            {
                var uiresponse = resp.ToUIResult<FoodOptionsListViewModel
                    , FoodOption>((Options) => GetList(model.VendorId)
                    , (vm) => RenderPartialViewToString("FoodOptionList", vm));

                return Json(uiresponse);
            }
            else
            {
                var uiresponse = resp.ToUIResult<FoodOptionEditModel
                    , FoodOption>((Options) => new FoodOptionEditModel(Options)
                    , (vm) => {
                        vm.Merge(resp);

                        return RenderPartialViewToString("AddEdit", vm);
                    });
                return Json(uiresponse);
            }
        }