public IHttpActionResult GetByRating(string rating) { var repo = DvdRepositoryFactory.GetRepository(); var dvds = repo.GetByRating(rating); return(Ok(dvds)); }
public IHttpActionResult Index() { var repo = DvdRepositoryFactory.GetRepository(); var dvds = repo.GetAllDvd(); return(Ok(dvds)); }
// GET: Dvd public ActionResult Details(int id) { var repo = DvdRepositoryFactory.GetRepository(); var model = repo.GetById(id); return(View(model)); }
public IHttpActionResult Update(UpdateDvdRequest request) { var repo = DvdRepositoryFactory.Create(); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Dvd dvd = repo.GetDvd(request.DvdId); if (dvd == null) { return(NotFound()); } dvd.Title = request.Title; dvd.Director = request.Director; dvd.ReleaseYear = request.ReleaseYear; dvd.Rating = request.Rating; dvd.Notes = request.Notes; repo.EditDvd(dvd); return(Ok(dvd)); }
public IHttpActionResult CreateNewDvd(Dvd dvd) { var repo = DvdRepositoryFactory.GetRepository(); repo.Insert(dvd); return(Ok(dvd.DvdId)); }
public IHttpActionResult DeleteById(int dvdId) { var repo = DvdRepositoryFactory.GetRepository(); repo.Delete(dvdId); return(Ok()); }
public IHttpActionResult UpdateById(Dvd dvd) { var repo = DvdRepositoryFactory.GetRepository(); repo.Update(dvd); return(Ok(dvd.DvdId)); }
public IHttpActionResult GetDvdsByTitle(string title) { var repo = DvdRepositoryFactory.GetRepository(); var dvds = repo.GetByTitle(title); return(Ok(dvds)); }
public IHttpActionResult GetDvdById(int id) { var repo = DvdRepositoryFactory.GetRepository(); var dvds = repo.GetById(id); return(Ok(dvds)); }
public IHttpActionResult GetByReleaseYear(int releaseYear) { var repo = DvdRepositoryFactory.GetRepository(); var dvds = repo.GetByYear(releaseYear); return(Ok(dvds)); }
public IHttpActionResult GetByDirector(string directorName) { var repo = DvdRepositoryFactory.GetRepository(); var dvds = repo.GetByDirector(directorName); return(Ok(dvds)); }
public IHttpActionResult NewDvd(GetDvds dvd) { var repo = DvdRepositoryFactory.GetRepository(); repo.SaveNew(dvd.Title, dvd.ReleaseYear, dvd.Director, dvd.Rating, dvd.Notes); return(Ok()); }
public IHttpActionResult UpdateDvd(GetDvds dvd) { var repo = DvdRepositoryFactory.GetRepository(); repo.Edit(dvd.DvdId, dvd.Title, dvd.ReleaseYear, dvd.Director, dvd.Rating, dvd.Notes); return(Ok()); }
public IHttpActionResult Delete(int dvdID) { DVDdb dvd = DvdRepositoryFactory.GetRepository().Get(dvdID); if (dvd == null) { return(NotFound()); } DvdRepositoryFactory.GetRepository().Delete(dvdID); return(Ok()); }
public IHttpActionResult DeleteDvd(int DvdId) { Dvd dvd = DvdRepositoryFactory.Create().GetDvdByID(DvdId); if (dvd == null) { return(NotFound()); } DvdRepositoryFactory.Create().DeleteDvd(DvdId); return(Ok()); }
public IHttpActionResult Delete(int id) { var repo = DvdRepositoryFactory.Create(); Dvd movie = repo.GetDvd(id); if (movie == null) { return(NotFound()); } repo.DeleteDvd(id); return(Ok()); }
public void EditDvd(int id, Dvd dvd) { //validate edit if (ModelState.IsValid) { IDvdRepository DvdRepo = DvdRepositoryFactory.Create(); DvdRepo.Edit(dvd); } else { Content(HttpStatusCode.BadRequest, "Model state invalid"); } }
public IHttpActionResult GetDvdByDirector(string director) { List <Dvd> dvds = DvdRepositoryFactory.Create().GetDvdByDirector(director); if (dvds == null) { return(NotFound()); } else { return(Ok(dvds)); } }
public IHttpActionResult Get(int dvdID) { DVDdb dvd = DvdRepositoryFactory.GetRepository().Get(dvdID); if (dvd == null) { return(NotFound()); } else { return(Ok(dvd)); } }
public IHttpActionResult GetDvdByTitle(string title) { List <Dvd> dvds = DvdRepositoryFactory.Create().GetDvdByTitle(title); if (dvds == null) { return(NotFound()); } else { return(Ok(dvds)); } }
public IHttpActionResult GetAllDvds() { List <Dvd> dvds = DvdRepositoryFactory.Create().GetAllDvds(); if (dvds == null) { return(NotFound()); } else { return(Ok(dvds)); } }
public IHttpActionResult GetDvdByReleaseYear(int releaseYear) { List <Dvd> dvds = DvdRepositoryFactory.Create().GetDvdByReleaseYear(releaseYear); if (dvds == null) { return(NotFound()); } else { return(Ok(dvds)); } }
public IHttpActionResult Get(int id) { var repo = DvdRepositoryFactory.Create(); Dvd dvd = repo.GetDvd(id); if (dvd == null) { return(NotFound()); } else { return(Ok(dvd)); } }
public IHttpActionResult GetByDirector(string directorName) { var repo = DvdRepositoryFactory.GetRepository(); try { var result = repo.GetByDirector(directorName); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult GetByReleaseDate(DateTime date) { var repo = DvdRepositoryFactory.GetRepository(); try { var result = repo.GetByReleaseDate(date); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult GetDvdById(int DvdId) { Dvd dvd = DvdRepositoryFactory.Create().GetDvdByID(DvdId); if (dvd == null) { return(NotFound()); } else { //Creates HTTP Response status 200 return(Ok(dvd)); } }
public ActionResult Add(DvdShortItem model) { var repo = DvdRepositoryFactory.GetRepository(); try { repo.Insert(model); } catch (Exception ex) { throw ex; } return(View(model)); }
public IHttpActionResult SearchByCategory(string Category, string SearchTerm) { var repo = DvdRepositoryFactory.GetRepository(); try { var result = repo.SearchByCategory(Category, SearchTerm); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult LoadDvds() { var repo = DvdRepositoryFactory.GetRepository(); try { var result = repo.GetAll(); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult DvdDetails(int dvdID) { var repo = DvdRepositoryFactory.GetRepository(); try { var result = repo.GetByID(dvdID); return(Ok(result)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }