File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
sample/EntityFrameworkCore.DataEncryption.Sample/Controllers Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ using EntityFrameworkCore . DataEncryption . Sample . Context ;
2+ using EntityFrameworkCore . DataEncryption . Sample . Entities ;
3+ using Microsoft . AspNetCore . Mvc ;
4+
5+ namespace EntityFrameworkCore . DataEncryption . Sample . Controllers ;
6+
7+ [ ApiController ]
8+ [ Route ( "[controller]" ) ]
9+ public class AuthorController : ControllerBase
10+ {
11+ private readonly SampleDbContext _context ;
12+
13+ public AuthorController ( SampleDbContext context )
14+ {
15+ _context = context ;
16+ }
17+
18+ [ HttpGet ( Name = "Filter" ) ]
19+ public Task < IActionResult > FilterAsync ( [ FromQuery ] string phone )
20+ {
21+ return Task . FromResult < IActionResult > ( Ok ( _context . Authors . Where ( a=> a . Phone == phone ) . ToList ( ) ) ) ;
22+ }
23+
24+ [ HttpPost ( Name = "Insert" ) ]
25+ public async Task < IActionResult > InsertAsync ( [ FromBody ] Author author )
26+ {
27+ await _context . Authors . AddAsync ( author ) ;
28+ await _context . SaveChangesAsync ( ) ;
29+ return NoContent ( ) ;
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments