码迷,mamicode.com
首页 > 其他好文 > 详细

啊啊啊啊啊啊

时间:2015-07-16 19:31:47      阅读:105      评论:0      收藏:0      [点我收藏+]

标签:

public ActionResult Index()
{
List<RandomData> dataList = new List<RandomData>
{
new RandomData {Id = 1, UserId = 1,RandomDatas = 1,IsSelected = 0, UpToDate= Convert.ToDateTime("2015-7-18 23:59:59")},

new RandomData {Id = 12, UserId = 51,RandomDatas = 3,IsSelected = 0, UpToDate= Convert.ToDateTime("2015-7-15 23:59:59")}

};
dataList = dataList.Where(o => DateTime.Compare(o.UpToDate, Convert.ToDateTime("2015-7-16 23:59:59")) < 0).ToList();
RandomData val = GenerateRandomNumber(dataList);
var query = (from r in dataList
where r.UserId == val.UserId
select r).FirstOrDefault().IsSelected = 1;

return View();
}

public static RandomData GenerateRandomNumber(List<RandomData> dataList)
{
Random rd = new Random();
int i = rd.Next(dataList.Count);
return dataList[i];
}

啊啊啊啊啊啊

标签:

原文地址:http://www.cnblogs.com/niejun/p/4652030.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!