June 2017
Intermediate to advanced
274 pages
7h 45m
English
Finally, we are ready to create REST API for ProductService. After the changes are made, here is what ProductController will look like:
using System.Linq; using FlixOne.BookStore.ProductService.Models; using FlixOne.BookStore.ProductService.Persistence; using Microsoft.AspNetCore.Mvc; namespace FlixOne.BookStore.ProductService.Controllers { [Route("api/[controller]")] public class ProductController : Controller { private readonly IProductRepository _ProductRepository; public ProductController(IProductRepository ProductRepository) { _ProductRepository = ProductRepository; } public IActionResult Get() { var Productvm = _ProductRepository.GetAll().Select(Product => new ProductViewModel { CategoryId = Product.CategoryId, ...Read now
Unlock full access