有一种简单的方法可以在美国创建仅限时区的列表吗?我正在使用此代码,但它产生每个时区,我只想要太平洋,中部,山区和东部
public List<TimeZoneInfo> _timeZones = TimeZoneInfo.GetSystemTimeZones().ToList();
Run Code Online (Sandbox Code Playgroud) 这是我控制器的代码片段
[HttpPost]
public ActionResult Cancel(string id,FormCollection collection)
{
//This is how I would like to declare appt but I cannot seem to correctly pass id into this method
//var appt = Application.Session.GetObjectFromOid<Appointment>(new ObjectId(id));
//I am trying to do it this way instead but I get an error
var appt = (Appointment)Application.Appointments.Where(a=>a.Id.Equals(collection["Id"]));
.....
}
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:无法将'WhereListIterator`1 [Web.Model.Appointment]'类型的对象强制转换为'Web.Model.Appointment'.
这是我的看法:
<input type="button" value="Save" onclick="updateCancel(); return false;" /><button>Save</button>
Run Code Online (Sandbox Code Playgroud)
这是我的功能
function updateCancel() {
$('#cancel').ajaxSubmit({
});
}
Run Code Online (Sandbox Code Playgroud)
那我为什么会收到这个错误呢?或者有没有办法将Model.Data.Id传递给我的函数,以便我可以只使用id?