topical media & game development

talk show tell print

#mobile-application-03-MVCDerbyService-MVCDerbyService-Controllers-DerbyServiceController.cs / cs



  using System.Collections.Generic;
  using System.Linq;
  using System.Web.Mvc;
  using MVCDerbyService.Models;
  using MVCDerbyService.Results;
  
  namespace MVCDerbyService.Controllers
  {
      public class DerbyServiceController : Controller
      {
  public ActionResult Index()
  {
      return View();
  }
  
          public ActionResult DerbyNames()
          {
              DerbyContext dc = new DerbyContext();
              List<DerbyNames> names = dc.DerbyNames.ToList();
              return new AcceptHeaderResult(names);
          }
  
          public ActionResult Leagues()
          {
              DerbyContext dc = new DerbyContext();
              List<Leagues> names = dc.Leagues.ToList();
              return new AcceptHeaderResult(names);
          }
  
          //public ActionResult DerbyNames(string format)
          //{
          //    DerbyContext dc = new DerbyContext();
          //    List<DerbyNames> names = dc.DerbyNames.ToList();
          //    if (string.Compare(format, "xml") == 0)
          //    {
          //        return new XmlResult(names);
          //    }
          //    return Json(names, JsonRequestBehavior.AllowGet);
          //}
      }
  }
  


(C) Æliens 04/09/2009

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.