public JsonResult AddUserLevelPrice([DataSourceRequest] DataSourceRequest request, UserLevelPriceModel userLevelPriceModel) { try { if (userLevelPriceModel != null) { userLevelPriceModel.EmployeeID = this.SystemUserSession.SystemUserID; this.userLevelPriceService = new UserLevelPriceService(); var userLevelPrice = DataTransfer.Transfer<User_Level_Price>( userLevelPriceModel, typeof(UserLevelPriceModel)); userLevelPriceModel.ID = this.userLevelPriceService.Add(userLevelPrice); userLevelPrice = this.userLevelPriceService.QueryByID(userLevelPriceModel.ID); userLevelPriceModel = DataTransfer.Transfer<UserLevelPriceModel>( userLevelPrice, typeof(User_Level_Price)); userLevelPriceModel.StatusName = userLevelPriceModel.Status == 0 ? "正常" : "停止"; return this.Json(new[] { userLevelPriceModel }.ToDataSourceResult(request, this.ModelState)); } return this.Json(string.Empty); } catch (Exception exception) { throw new Exception(exception.Message, exception); } }
/// <summary> /// 修改会员等级价格列表. /// </summary> /// <param name="request"> /// The request. /// </param> /// <param name="userLevelPriceModel"> /// userLevelPriceModel的对象实例. /// </param> /// <returns> /// The <see cref="ActionResult"/>. /// </returns> public JsonResult ModifyUserLevelPrice([DataSourceRequest] DataSourceRequest request, UserLevelPriceModel userLevelPriceModel) { try { if (userLevelPriceModel != null) { this.userLevelPriceService = new UserLevelPriceService(); var userLevelPrice = DataTransfer.Transfer<User_Level_Price>( userLevelPriceModel, typeof(UserLevelPriceModel)); this.userLevelPriceService.Modify(userLevelPrice); userLevelPriceModel.StatusName = userLevelPriceModel.Status == 0 ? "正常" : "停止"; return this.Json(new[] { userLevelPriceModel }.ToDataSourceResult(request, this.ModelState)); } return this.Json(string.Empty); } catch (Exception exception) { throw new Exception(exception.Message, exception); } }