Beispiel #1
0
        public ActionResult EditShop(ShopModel 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.ProvinceId        = model.ProvinceId;
                    shop.CityId            = model.CityId;
                    shop.CountyId          = model.CountyId;
                    shop.Address           = model.Address;
                    shop.MainSale          = model.MainSale;
                    shop.Content           = model.Content;
                    shop.StartBusinessTime = model.StartBusinessTime;
                    shop.EndBusinessTime   = model.EndBusinessTime;
                    //shop.IsDelivery = model.IsDelivery ? 1 : 0;
                    shop.Type       = model.Types;
                    shop.UpdateTime = DateTime.Now;

                    //修改保存到数据库
                    if (ShopBll.UpdateShop(shop, model.PlaceIds))
                    {
                        //日志记录
                        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));
        }