public PersonUserService(VehicleDiaryDbContext vehicleDiaryDbContext, IEventAggregator eventAggregator) { _context = vehicleDiaryDbContext; _eventAggregator = eventAggregator; _eventAggregator.Subscribe(this); Vehicles = new List <VehicleModel>(); }
public async Task <T> Update(T entity) { _context = new VehicleDiaryDbContext(); _context.Set <T>().AddOrUpdate(entity); await _context.SaveChangesAsync(); return(entity); }
public async Task <T> Create(T entity) { _context = new VehicleDiaryDbContext(); var res = _context.Set <T>().Add(entity); await _context.SaveChangesAsync(); return(res); }
public async Task <bool> Delete <S>(S id) { // overkill reflection attempt // var idType = id.GetType(); // var idProperty = idType.GetProperty(propertyName); _context = new VehicleDiaryDbContext(); T res = await _context.Set <T>().FindAsync(id); _context.Set <T>().Remove(res); await _context.SaveChangesAsync(); return(true); }
public ServiceUserService(VehicleDiaryDbContext vehicleDiaryDbContext) { _context = vehicleDiaryDbContext; VehicleServices = new List <VehicleServiceModel>(); }
public VehicleService(VehicleDiaryDbContext vehicleDiaryDbContext) { _context = vehicleDiaryDbContext; SaleListings = new List <SaleListingModel>(); }
public UserService(VehicleDiaryDbContext vehicleDiaryDbContext) { _context = vehicleDiaryDbContext; }
public async Task <IEnumerable <T> > GetAll() { _context = new VehicleDiaryDbContext(); return(await _context.Set <T>().ToListAsync()); }
public Task <T> Get <S>(S id) { _context = new VehicleDiaryDbContext(); return(_context.Set <T>().FindAsync(id)); }