42 lines
1.2 KiB
C#
42 lines
1.2 KiB
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
using LCU.Shared.Collections.RepoApiLib.Models.Settings;
|
|
using LCU.Shared.Collections.RepoApiLib.Persistence;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace LCU.Shared.Collections.RepoApiLib.Repositories.Settings
|
|
{
|
|
public class BodyStyleRepository : BaseRepository, IBodyStyleRepository
|
|
{
|
|
|
|
public BodyStyleRepository(AppDbContext context) : base(context)
|
|
{
|
|
}
|
|
|
|
public async Task<IEnumerable<BodyStyle>> ListAllAsync()
|
|
{
|
|
return await _context.BodyStyleCodes.ToListAsync();
|
|
}
|
|
|
|
public async Task AddAsync(BodyStyle bodyStyleCodes)
|
|
{
|
|
await _context.BodyStyleCodes.AddAsync(bodyStyleCodes);
|
|
}
|
|
|
|
public async Task<BodyStyle> FindByIdAsync(string id)
|
|
{
|
|
return await _context.BodyStyleCodes.Where(c => c.Code.Equals(id)).FirstOrDefaultAsync();
|
|
}
|
|
|
|
public void Update(BodyStyle category)
|
|
{
|
|
_context.BodyStyleCodes.Update(category);
|
|
}
|
|
|
|
public void Remove(BodyStyle category)
|
|
{
|
|
_context.BodyStyleCodes.Remove(category);
|
|
}
|
|
}
|
|
} |