Crud implemented by Contact
This commit is contained in:
33
BlazorSyncfusionCrm/Server/Controllers/NotesController.cs
Normal file
33
BlazorSyncfusionCrm/Server/Controllers/NotesController.cs
Normal file
@ -0,0 +1,33 @@
|
||||
using BlazorSyncfusionCrm.Server.Data;
|
||||
using BlazorSyncfusionCrm.Shared;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.ChangeTracking;
|
||||
|
||||
namespace BlazorSyncfusionCrm.Server.Controllers
|
||||
{
|
||||
[Route("api/[controller]")]
|
||||
[ApiController]
|
||||
public class NotesController : ControllerBase
|
||||
{
|
||||
private readonly DataContext _context;
|
||||
|
||||
public NotesController(DataContext context)
|
||||
{
|
||||
_context = context;
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
public async Task<ActionResult<List<Note>>> GetAllNotes()
|
||||
{
|
||||
return await _context.Notes
|
||||
.Include(n => n.Contact)
|
||||
.OrderByDescending(n => n.DateCreated)
|
||||
.ToListAsync();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user