Files
ERP_Distribution/Distribution/Features/Route/RouteRepository.cs
T
Kalana B. Thilakarathna ac3f34e4f3 Initial project setup with domain, UoW, and API structure
Added .gitignore, solution, and project files for .NET 10. Introduced AGENTS.md and PLAN.md for guidelines and planning. Implemented appsettings.json, launchSettings.json, and MySQL config. Created AppDBContext and all domain models with composite keys. Added IUnitOfWork and EFUnitOfWork. Structured feature folders for Region, Route, Vehicle, Store, Warehouse, and Order with DTOs, repositories, services, and controllers. Added initial EF Core migrations and sample HTTP request. Registered dependencies and enabled OpenAPI in development.
2026-08-18 08:25:18 +05:30

26 lines
706 B
C#

using Distribution.Data;
using Microsoft.EntityFrameworkCore;
namespace Distribution.Features.Route;
public class RouteRepository(AppDBContext context) : IRouteRepository
{
public async Task<Models.Route?> GetByIdAsync(Guid id) =>
await context.Routes.FindAsync(id);
public async Task<List<Models.Route>> GetAllAsync() =>
await context.Routes.ToListAsync();
public async Task AddAsync(Models.Route entity) =>
await context.Routes.AddAsync(entity);
public void Update(Models.Route entity) =>
context.Routes.Update(entity);
public void Remove(Models.Route entity)
{
entity.IsActive = false;
context.Routes.Update(entity);
}
}