Introducing ViewModel

Add a new class to the models folder and name it ProductViewModel--this is because in our monolithic application, whenever we search for a product, it should be displayed with its product category. In order to support this, we need to incorporate the necessary fields into our view model. Our ProductViewModel class will look like this:

    using System;    namespace FlixOne.BookStore.ProductService.Models    {        public class ProductViewModel        {            public Guid ProductId { get; set; }            public string ProductName { get; set; }            public string ProductDescription { get; set; }            public string ProductImage { get; set; }            public decimal ProductPrice { get; set; }            public Guid CategoryId { get; set; }            public string CategoryName { get; set; } public ...

Get Building Microservices with .NET Core now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.