47 lines
1.4 KiB
C#
47 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using _0_Framework.InfraStructure;
|
|
using AccountManagement.Application.Contracts.Account;
|
|
using AccountManagement.Application.Contracts.CameraAccount;
|
|
using AccountManagement.Domain.CameraAccountAgg;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace AccountMangement.Infrastructure.EFCore.Repository;
|
|
|
|
public class CameraAccountRepository : RepositoryBase<long, CameraAccount>, ICameraAccountRepository
|
|
|
|
{
|
|
private readonly AccountContext _context;
|
|
public CameraAccountRepository(AccountContext context) : base(context)
|
|
{
|
|
_context = context;
|
|
}
|
|
|
|
public CameraAccount GetBy(string username)
|
|
{
|
|
return _context.CameraAccounts.FirstOrDefault(x => x.Username == username);
|
|
}
|
|
|
|
public CameraAccount GetById(long id)
|
|
{
|
|
return _context.CameraAccounts.FirstOrDefault(x => x.id == id);
|
|
}
|
|
|
|
public EditCameraAccount GetDetails(long id)
|
|
{
|
|
return _context.CameraAccounts.Select(x => new EditCameraAccount()
|
|
{
|
|
Id = x.id,
|
|
Username = x.Username,
|
|
Mobile = x.Mobile,
|
|
WorkshopId = x.WorkshopId,
|
|
WorkshopName = x.WorkshopName,
|
|
AccountId = x.AccountId,
|
|
IsActiveString = x.IsActiveSting
|
|
|
|
}).FirstOrDefault(x => x.Id == id);
|
|
}
|
|
} |