コード例 #1
0
 /// <summary>
 /// Will get a specific Genre found by the Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>    
 public HttpResponseMessage Get(int id)
 {
     var genre = new Facade().GetGenryRepository().Get(id);
     GenreDto genreDto = null;
     if (genre != null)
     {
         genreDto = new GenreConverter().Convert(genre);
         return Request.CreateResponse<GenreDto>(HttpStatusCode.OK, genreDto);
     }
     var response = new HttpResponseMessage(HttpStatusCode.NotFound)
     {
         Content = new StringContent("Genre not found.")
     };
     throw new HttpResponseException(response);
 }
コード例 #2
0
 /// <summary>
 /// Will get a specific Order from database.
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>    
 public HttpResponseMessage Get(int id)
 {
     var order = new Facade().GetOrderRepository().Get(id);
     OrderDto orderDto = null;
     if (order != null)
     {
         orderDto = new OrderConverter().Convert(order);
         return Request.CreateResponse<OrderDto>(HttpStatusCode.OK, orderDto);
     }
     var response = new HttpResponseMessage(HttpStatusCode.NotFound)
     {
         Content = new StringContent("Order not found.")
     };
     throw new HttpResponseException(response);
 }
コード例 #3
0
 /// <summary>
 /// Will get a specific Movie found by the Id
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public HttpResponseMessage Get(int id)
 {
     var movie = new Facade().GetMovieRepository().Get(id);
     MovieDto movieDto = null;
     if (movie != null)
     {
         movieDto = new MovieConverter().Convert(movie);
         return Request.CreateResponse<MovieDto>(HttpStatusCode.OK, movieDto);
     }
     var response = new HttpResponseMessage(HttpStatusCode.NotFound)
     {
         Content = new StringContent(" Movie not found.")
     };
     throw new HttpResponseException(response);
 }
コード例 #4
0
 /// <summary>
 /// Will get all Order from database
 /// </summary>
 /// <returns></returns>
 public IEnumerable<OrderDto> GetAll()
 {
     var order = new Facade().GetOrderRepository().ReadAll();
     return new OrderConverter().Convert(order);
 }
コード例 #5
0
 /// <summary>
 /// Will get all Customer from database.
 /// </summary>
 /// <returns></returns>
 public IEnumerable<CustomerDto> GetAll()
 {
     var customer = new Facade().GetCustomerRepository().ReadAll();
     return new CustomerConverter().Convert(customer);
 }
コード例 #6
0
 /// <summary>
 /// Will get all Genre from database.
 /// </summary>
 /// <returns></returns>
 public IEnumerable<GenreDto> GetAll()
 {
     var genre = new Facade().GetGenryRepository().ReadAll();
     return new GenreConverter().Convert(genre);
 }
コード例 #7
0
 /// <summary>
 /// Will get all Orderlines from database
 /// </summary>
 /// <returns>
 /// </returns>
 public IEnumerable<OrderLineDto> GetAll()
 {
     var orderLine = new Facade().GetOrderLineRepository().ReadAll();
     return new OrderLineConverter().Convert(orderLine);
 }
コード例 #8
0
 public IEnumerable<MovieDto> GetMovies()
 {
     var movies = new Facade().GetMovieRepository().ReadAll();
        return new MovieConverter().Convert(movies);
 }