Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Threading.Tasks;
- using Microsoft.AspNetCore.Mvc;
- using EcommerceApp2.Models;
- namespace EcommerceApp2.Controllers
- {
- public class ProductsController : Controller
- {
- private readonly ProductService _service;
- public ProductsController(ProductService service)
- {
- _service = service;
- }
- public IActionResult Index()
- {
- return View(_service.GetProducts());
- }
- public IActionResult Product()
- {
- // return View(new ProductsModel() { Id=42, Name="Phone", Price=450, Category="High-Tech" });
- return View(_service.GetProductById(1));
- }
- public IActionResult Error()
- {
- return View();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement