Controllers/ComicsAPI


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using MvcBootstrap.Models;
using System.Web.Mvc;

namespace MvcBootstrap.Controllers
{
  public class ComicsAPIController : ApiController
  {
    Comic comic = new Comic();
    List comicList = new List();

    public List Get()
    {
      return comic.GetAllComics();
    }

    public List Get(string id)
    {
      int i = 0;
      if (int.TryParse(id, out i))
      {
        comicList.Add(comic.GetComicByID(i));
        return comicList;
      }
      else
      {
        return comic.GetComicsByTitle(id);
      }
    }

    // PUT api//5
    public void Put(int id, [FromBody]string value)
    {
    }

    // DELETE api//5
    public void Delete(int id)
    {
    }
  }
}