Esempio n. 1
0
        public ActionResult EditShop(int id)
        {
            IShopBLL ShopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL");

            var shopInfo = ShopBll.GetEntity(index => index.Id == id);

            if (shopInfo != null)
            {
                ShopPlatformModel model = new ShopPlatformModel();
                model.Id                = shopInfo.Id;
                model.ShopName          = shopInfo.ShopName;
                model.MainSale          = shopInfo.MainSale;
                model.Tel               = shopInfo.Phone;
                model.ProvinceId        = shopInfo.ProvinceId;
                model.ProvinceList      = GetProvinceList();
                model.CityId            = shopInfo.CityId;
                model.CityList          = base.GetCityList(shopInfo.ProvinceId);
                model.CountyId          = shopInfo.CountyId;
                model.CountyList        = base.GetCountyList(shopInfo.CityId);
                model.Address           = shopInfo.Address;
                model.Content           = shopInfo.Content;
                model.StartBusinessTime = shopInfo.StartBusinessTime;
                model.EndBusinessTime   = shopInfo.EndBusinessTime;
                model.TimeList          = GetBusinessTimeList();
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Esempio n. 2
0
        public ActionResult EditShop(ShopPlatformModel model)
        {
            JsonModel jm = new JsonModel();

            //如果表单验证成功
            if (ModelState.IsValid)
            {
                IShopBLL ShopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL");

                T_Shop shop = ShopBll.GetEntity(m => m.Id == model.Id);
                if (shop != null)
                {
                    shop.ShopName          = model.ShopName;
                    shop.Phone             = model.Tel;
                    shop.Address           = model.Address;
                    shop.MainSale          = model.MainSale;
                    shop.Content           = model.Content;
                    shop.StartBusinessTime = model.StartBusinessTime;
                    shop.EndBusinessTime   = model.EndBusinessTime;
                    shop.UpdateTime        = DateTime.Now;

                    //修改保存到数据库
                    if (ShopBll.Update(shop))
                    {
                        //日志记录
                        jm.Content = PropertyUtils.ModelToJsonString(model);
                    }
                    else
                    {
                        jm.Msg = "编辑失败";
                    }
                }
                else
                {
                    jm.Msg = "该门店不存在";
                }
            }
            else
            {
                jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR;
            }
            return(Json(jm, JsonRequestBehavior.AllowGet));
        }