34 lines
826 B
C#
34 lines
826 B
C#
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();
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|