joaopaulofcc

Untitled

Sep 15th, 2021
921
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Threading.Tasks;
  5. using Microsoft.AspNetCore.Http;
  6. using Microsoft.AspNetCore.Mvc;
  7. using projetoTeste.Models;
  8.  
  9. namespace projetoTeste.Controllers
  10. {
  11.     [Route("[controller]/[action]")]
  12.     [ApiController]
  13.     public class CargoController : ControllerBase
  14.     {
  15.         private BDContexto contexto;
  16.        
  17.         public CargoController(BDContexto bdContexto)
  18.         {
  19.             contexto = bdContexto;
  20.         }
  21.        
  22.         [HttpGet]
  23.         public List<Cargo> Listar()
  24.         {
  25.             return contexto.Cargo.ToList();
  26.         }
  27.     }
  28. }
RAW Paste Data