我正在使用 AutoMapper 来检索 Order 对象。对于价格,我使用对象的扩展方法解析,我需要传入 aPriceType和 aMarkup进行计算。
目前,我让它只为PriceType
//in the mapping
.ForMember(d => d.TotalPrice, opt => opt.ResolveUsing((src, dest, destMember, resContext) => dest.TotalPrice= src.UserTotalPrice((string)resContext.Items["Pricing"])))
//pass in the variable
var s = Mapper.Map<Order, NewOrder>(order, opts => opts.Items["Pricing"] = "A");
Run Code Online (Sandbox Code Playgroud)
我需要传递标记
//in the mapping
.ForMember(d => d.TotalPrice, opt => opt.ResolveUsing((src, dest, destMember, resContext) => dest.TotalPrice= src.UserTotalPrice((string)resContext.Items["Pricing"]),(decimal)resContext.Items["Markup"]))
Run Code Online (Sandbox Code Playgroud)
问题:如何通过传入来设置 2 个元素?
var s = Mapper.Map<Order, NewOrder>(order, opts => opts.Items["Pricing"] = "A"**********missing code**************);
Run Code Online (Sandbox Code Playgroud) 我有一个带disabledDates功能的AngularUI Bootstrap日历
<uib-datepicker ng-model="date" ng-change="change()" date-disabled="disabledDates(date,mode)"></uib-datepicker>
Run Code Online (Sandbox Code Playgroud)
这是功能:
$scope.disabledDates = function (date, mode) {
if ($scope.daysAvailable != null) {
return mode === 'day' && $scope.daysAvailable.indexOf(date.getDay() + 1) == -1;
}
}
Run Code Online (Sandbox Code Playgroud)
$scope.daysAvailable是从服务器加载$http请求
$scope.init = function () {
return $http.get('/OrderEntry/GetAvailableDays', { params: { method: shipMethod, state: state, zip: zip } }).then(function (data) {
$scope.daysAvailable data.data;
});
}
Run Code Online (Sandbox Code Playgroud)
问题是我的HTML正在加载(并disabledDates()在结果从服务器返回并加载到控制器之前调用init()
如何在返回数据之前阻止日历加载?