Light12306/ChatRoomServer.Www/Controllers/AnnouncementController.cs

32 lines
891 B
C#
Raw Normal View History

2015-07-03 21:04:37 +08:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace ChatRoomServer.Www.Controllers
{
using System.Data.Entity;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
2015-07-08 17:24:45 +08:00
using System.Web.Http.Cors;
2015-07-03 21:04:37 +08:00
using System.Web.Mvc.Filters;
using ChatRoomServer.Db;
using FSLib.MvcWeb;
using FSLib.Network.Http;
2015-07-08 17:24:45 +08:00
[EnableCors("http://12306.liebao.cn,http://test.fishlee.net", "*", "*", "")]
2015-07-03 21:04:37 +08:00
public class AnnouncementController : Controller
{
[AllowAnonymous]
[HttpGet, OutputCache(Duration = 1200, VaryByHeader = "Origin")]
public async Task<ContentResult> List()
{
var client = new HttpClient();
var ctx = client.Create<string>(HttpMethod.Get, $"http://{Request.Url.Host}:{Request.Url.Port}/api/announcement/list");
await ctx.SendTask();
return Content(ctx.Result, "application/json");
}
}
}