Adding
This commit is contained in:
+41
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using LCU.API.Internal.RepoApi.Repos.Models;
|
||||
using LCU.API.Internal.RepoApi.Repos.Persistence;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LCU.API.Internal.RepoApi.Repos.Repositories
|
||||
{
|
||||
public class SavedLocationRepository : BaseRepository, ISavedLocationRepository
|
||||
{
|
||||
public SavedLocationRepository(AppDbContext context) : base(context) { }
|
||||
|
||||
public async Task<IEnumerable<SavedLocation>> ListAsync()
|
||||
{
|
||||
return await _context.SavedLocations.ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<SavedLocation> FindByIdAsync(int id)
|
||||
{
|
||||
return await _context.SavedLocations.Where(savedLocation => savedLocation.ID == id).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<SavedLocation> AddAsync(SavedLocation savedLocation)
|
||||
{
|
||||
var result = await _context.SavedLocations.AddAsync(savedLocation);
|
||||
return result.Entity;
|
||||
}
|
||||
|
||||
public void Update(SavedLocation savedLocation)
|
||||
{
|
||||
_context.SavedLocations.Update(savedLocation);
|
||||
}
|
||||
|
||||
public void Remove(SavedLocation savedLocation)
|
||||
{
|
||||
_context.Remove(savedLocation);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user