示例#1
0
        public void GetPhotosByTime(int?key, string date, int?pageSize)
        {
            DateTime dateTime;

            Response.ContentType = "application/json";
            if (DateTime.TryParse(date, out dateTime))
            {
                var pageNo = key ?? 1;
                pageSize = pageSize ?? 128;
                int total;
                var result = _photoService.GetPhotosByTime(pageNo, dateTime, out total, (int)pageSize);
                Response.Write(JsonConvert.SerializeObject(new ApiList <Photo> {
                    Items = result, PageNo = pageNo, PageSize = (int)pageSize, Total = total
                }));
            }
            else
            {
                Response.Write("{'error':'wrong date'}");
            }
        }