public ActionResult AddShop(ShopModel model) { JsonModel jm = new JsonModel(); //如果表单模型验证成功 if (ModelState.IsValid) { IShopBLL ShopBll = BLLFactory <IShopBLL> .GetBLL("ShopBLL"); //初始化门店数据 T_Shop newShop = new T_Shop() { ShopName = model.ShopName, Phone = model.Tel, ProvinceId = model.ProvinceId, CityId = model.CityId, CountyId = model.CountyId, Address = model.Address, MainSale = model.MainSale, ShopUserId = model.ShopUserId, Content = model.Content, StartBusinessTime = model.StartBusinessTime, EndBusinessTime = model.EndBusinessTime, UpdateTime = DateTime.Now, Type = model.Types }; //如果服务小区不为空 if (!string.IsNullOrEmpty(model.PlaceIds)) { foreach (var placeId in model.PlaceIds.Split(',')) { newShop.ShopPlaces.Add(new R_ShopPlace() { PropertyPlaceId = Convert.ToInt32(placeId) }); } } //默认支付方式:货到现金支付 newShop.ShopPaymentManagements.Add(new T_ShopPaymentManagement() { PayTypeId = 3 }); // 保存到数据库 ShopBll.Save(newShop); //日志记录 jm.Content = PropertyUtils.ModelToJsonString(model); } else { // 保存异常日志 jm.Msg = ConstantParam.JSON_RESULT_MODEL_CHECK_ERROR; } return(Json(jm, JsonRequestBehavior.AllowGet)); }