Crud implemented by Contact

This commit is contained in:
2023-04-19 17:25:42 +02:00
parent 0234db870b
commit ede368b963
10 changed files with 334 additions and 31 deletions

View 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();
}
}
}