public SaveResult Create(Car car) { using (var context = new ApplicationDbContextCore( _serviceProvider.GetRequiredService <DbContextOptions <ApplicationDbContextCore> >())) { try { context.Cars.Add(car); var result = context.SaveChanges(); return(new SaveResult() { Status = result, Message = "Success" }); } catch (DbUpdateException ex) { return(new SaveResult() { Status = 0, Message = $"{ex.Message} {ex.InnerException}" }); } } }
public UnitOfWorkCore(ApplicationDbContextCore dbContextCore) { _databaseContextCore = dbContextCore; }
public ApplicationRepositoryCore(ApplicationDbContextCore contextCore) { EntitySet = contextCore.Set <TEntity>(); _context = contextCore; }