1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . Linq ;
4+ using System . Threading . Tasks ;
5+ using Microsoft . AspNetCore . Mvc ;
6+ using Microsoft . AspNetCore . Mvc . Rendering ;
7+ using Microsoft . EntityFrameworkCore ;
8+ using NETCore_AzureSQL . Data ;
9+ using NETCore_AzureSQL . Models ;
10+
11+ namespace NETCore_AzureSQL . Controllers
12+ {
13+ public class CustomersController : Controller
14+ {
15+ private readonly MyDbContext _context ;
16+
17+ public CustomersController ( MyDbContext context )
18+ {
19+ _context = context ;
20+ }
21+
22+ // GET: Customers
23+ public async Task < IActionResult > Index ( )
24+ {
25+ return View ( await _context . Customer . ToListAsync ( ) ) ;
26+ }
27+
28+ // GET: Customers/Details/5
29+ public async Task < IActionResult > Details ( int ? id )
30+ {
31+ if ( id == null )
32+ {
33+ return NotFound ( ) ;
34+ }
35+
36+ var customer = await _context . Customer
37+ . FirstOrDefaultAsync ( m => m . CustomerID == id ) ;
38+ if ( customer == null )
39+ {
40+ return NotFound ( ) ;
41+ }
42+
43+ return View ( customer ) ;
44+ }
45+
46+ private bool CustomerExists ( int id )
47+ {
48+ return _context . Customer . Any ( e => e . CustomerID == id ) ;
49+ }
50+
51+
52+ // GET: Customers/Create
53+ public IActionResult Create ( )
54+ {
55+ throw new NotImplementedException ( ) ;
56+ }
57+
58+ // POST: Customers/Create
59+ // To protect from overposting attacks, please enable the specific properties you want to bind to, for
60+ // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
61+ [ HttpPost ]
62+ [ ValidateAntiForgeryToken ]
63+ public async Task < IActionResult > Create ( [ Bind ( "CustomerID,FirstName,LastName" ) ] Customer customer )
64+ {
65+ throw new NotImplementedException ( ) ;
66+ }
67+
68+ // GET: Customers/Edit/5
69+ public async Task < IActionResult > Edit ( int ? id )
70+ {
71+ throw new NotImplementedException ( ) ;
72+ }
73+
74+ // POST: Customers/Edit/5
75+ // To protect from overposting attacks, please enable the specific properties you want to bind to, for
76+ // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
77+ [ HttpPost ]
78+ [ ValidateAntiForgeryToken ]
79+ public async Task < IActionResult > Edit ( int id , [ Bind ( "CustomerID,FirstName,LastName" ) ] Customer customer )
80+ {
81+ throw new NotImplementedException ( ) ;
82+ }
83+
84+ // GET: Customers/Delete/5
85+ public async Task < IActionResult > Delete ( int ? id )
86+ {
87+ throw new NotImplementedException ( ) ;
88+ }
89+ }
90+ }
0 commit comments