public async Task <T> CreteAsync(T newItem) { await context.Set <T>().AddAsync(newItem); await context.SaveChangesAsync(); return(newItem); }
public async Task <Guid> Create(TEntity entity) { await authContext.Set <TEntity>().AddAsync(entity); await authContext.SaveChangesAsync(); return(entity.Id); }
public Task <int> DeleteAsync <TEntity>(TEntity entity) where TEntity : class { DbEntityEntry dbEntityEntry = context.Entry(entity); if (dbEntityEntry.State != EntityState.Deleted) { dbEntityEntry.State = EntityState.Deleted; } else { context.Set <TEntity>().Attach(entity); context.Set <TEntity>().Remove(entity); } return(Task.FromResult(1)); }
public IEnumerable <TEntity> GetAll() { try { return(_vehicleContextContext.Set <TEntity>()); } catch (Exception ex) { throw new Exception($"Couldn't retrieve entities: {ex.Message}"); } }
public Task <IEnumerable <TEntity> > Handle(TQuery request, CancellationToken cancellationToken) { var entites = _context.Set <TEntity>().AsEnumerable(); if (entites == null) { throw new CustomException(HttpStatusCode.NotFound, new { entites = "No Vehicles Found" }); } return(Task.FromResult(entites)); }
public Repository(VehicleContext context) { _context = context; this.dbSet = context.Set <TEntity>(); }
public void EditVehicleMake(MakeView makeView) { context.Set <VehicleMake>().AddOrUpdate(Mapper.Map <VehicleMake>(makeView)); context.SaveChanges(); }
public PaymentRepository(VehicleContext context) { Context = context; Entities = Context.Set <CustomerBankAccount>(); }
public GenericRepository(VehicleContext context) { _context = context; dbSet = _context.Set <T>(); }
public VehiclesForSaleRepository(IUnitOfWork unitOfWork, VehicleContext context) { this.UnitOfWork = unitOfWork; this.Context = context; SaleEntities = Context.Set <VehiclesForSale>(); }
public GenericRepository(VehicleContext context) { this.Context = context; Entities = Context.Set <TEntity>(); }
public ItemsInStockRepository(IUnitOfWork unitOfWork, VehicleContext context) { UnitOfWork = unitOfWork; Context = context; StockEntities = Context.Set <ItemsInStockModel>(); }
public IQueryable <TEntity> GetAll <TEntity>() where TEntity : class { return(context.Set <TEntity>()); }
public CartRepository(VehicleContext context) { Context = context; CartEntities = Context.Set <Cart>(); StockEntities = Context.Set <ItemsInStockModel>(); }
public UserDetailsRepository(VehicleContext context) { Context = context; Entities = Context.Set <UserDetails>(); }
/// <summary> /// This a Contructor Generic Repository /// </summary> /// <param name="entities">Is a element from database</param> protected GenericRepositoryEntities(VehicleContext entities) { _entities = entities; Dbset = entities.Set <T>(); // }
public BaseRepository(VehicleContext context) { Db = context; DbSet = Db.Set <TEntity>(); }