public IHttpActionResult GetAll() { IEnumerable <Dvd> found = _repo.GetAll(); IEnumerable <JObject> output = DvdMapper.ToJsonList(found); return(Ok(output)); }
public IHttpActionResult Add(JObject input) { Dvd dvd = DvdMapper.ToDVD(input); _repo.Create(dvd); JObject result = DvdMapper.ToJSON(dvd); return(Created($"dvd/{dvd.DvdId}", result)); }
public IHttpActionResult GetRating(string rating) { IEnumerable <Dvd> found = _repo.GetByRating(rating); if (found == null) { return(NotFound()); } IEnumerable <JObject> output = DvdMapper.ToJsonList(found); return(Ok(output)); }
public IHttpActionResult GetDate(string releaseDate) { IEnumerable <Dvd> found = _repo.GetByYear(releaseDate); if (found == null) { return(NotFound()); } IEnumerable <JObject> output = DvdMapper.ToJsonList(found); return(Ok(output)); }
public IHttpActionResult Get(int id) { var found = _repo.Get(id); if (found == null) { return(NotFound()); } JObject result = DvdMapper.ToJSON(found); return(Ok(result)); }
public void Update(int id, JObject input) { Dvd dvd = DvdMapper.ToDVD(input); _repo.Update(dvd); }