using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace Insus.NET.Controllers
{
public class CommonsController : Controller
{
public JsonResult ValidateDate(string date)
{
object _Data;
DateTime dt;
if (DateTime.TryParse(date, out dt))
{
_Data = new { result = true };
}
else
{
_Data = new { result = false };
}
return new JsonResult
{
Data = _Data,
ContentEncoding = System.Text.Encoding.UTF8,
JsonRequestBehavior = JsonRequestBehavior.AllowGet
};
}
}
}
airExpressApp.directive('validateDate', function ($http, $q) {
return {
restrict: 'AE',
require: 'ngModel',
link: function ($scope, element, attributes, ngModelController) {
ngModelController.$asyncValidators.dataValid = function (modelValue, viewValue) {
var deferred = $q.defer();
var obj = {};
obj.date = modelValue;
$http({
method: 'POST',
url: '/Commons/ValidateDate',
dataType: 'json',
headers: {
'Content-Type': 'application/json; charset=utf-8'
},
data: JSON.stringify(obj),
}).then(function (response) {
if (ngModelController.$isEmpty(modelValue) || response.data.result) {
deferred.resolve();
} else {
deferred.reject();
}
});
return deferred.promise;
};
}
}
});
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有