/
EpisodeList.aspx.cs
31 lines (27 loc) · 947 Bytes
/
EpisodeList.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AmosBatista.ComicsServer.Core.Data.Repository;
using AmosBatista.ComicsServer.Core;
using Newtonsoft.Json;
namespace AmosBatista.ComicServer.WebServer
{
public partial class EpisodeList : System.Web.UI.Page
{
// Function that will return the JSON-format of all episode list
protected void Page_Load(object sender, EventArgs e)
{
Response.Expires = -1;
// Loading the episode from repository
EpisodeRepository epsRepository = new EpisodeRepository();
var episodeList = epsRepository.AllEpisodeList();
Response.Clear();
Response.ContentType = "application/json; charset=utf-8";
Response.Write(JsonConvert.SerializeObject(episodeList));
Response.End();
}
}
}