예제 #1
0
        // GET: Format
        public ActionResult Index()
        {
            FormatList formats = new FormatList();

            formats.Load();
            return(View(formats));
        }
예제 #2
0
        public void LoadTest()
        {
            FormatList formats = new FormatList();

            formats.Load();

            int expected = 3;
            int actual   = formats.Count;

            Assert.AreEqual(expected, actual);
        }
예제 #3
0
        public void DeleteTest()
        {
            FormatList formats = new FormatList();

            formats.Load();

            //Find the format with the description testingformat
            Format format = formats.FirstOrDefault(f => f.Description == "UpdatedFormat");

            //Delete it
            int result = format.Delete();

            Assert.IsTrue(result == 1);
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                formats = new FormatList();
                formats.Load();

                Reload();

                //pretend someone clicked in the ddlFormats, send it with the sender and the e from this event
                ddlFormats_SelectedIndexChanged(sender, e);

                //Load data into the session
                Session["formats"] = formats;
            }
            else
            {
                //is a PostBack, kept in session, get the objects
                formats = (FormatList)Session["formats"];
            }
        }
예제 #5
0
 // GET: api/Format
 public IEnumerable <Format> Get()
 {
     formatList = new FormatList();
     formatList.Load();
     return(formatList);
 }