public IEnumerable <Employee> GetStudentInfo() { Test1232DbContext testDbContext = new Test1232DbContext(); testDbContext.Employees.Add(new Employee { Id = 11, Salary = 5555, dob = DateTime.Now }); testDbContext.SaveChanges(); var student = from s in testDbContext.Employees //where s.Id == 1 select s; IEnumerable <Employee> enumera = student.ToList(); return(enumera); }
static void Main(string[] args) { #region Test UnitOfWork concept Test1232DbContext dbContext = new Test1232DbContext(); UnitOfWork unitOfWork = new UnitOfWork(dbContext); var a = unitOfWork.GetRepo <Employee>().GetAll().Select(p => p.Salary); foreach (Employee employee in unitOfWork.GetRepo <Employee>().GetAll()) { Console.WriteLine(employee.Salary); } unitOfWork.GetRepo <Employee>().Delete(1); unitOfWork.GetRepo <Order>().Insert(new Order { Id = 2, Item = "dgads" }); unitOfWork.GetRepo <Order>().Insert(new Order { Id = 3, Item = "dgads" }); unitOfWork.GetRepo <Order>().Delete(2); unitOfWork.Save(); #endregion #region Recursive test ReverseParagraph reversePara = new ReverseParagraph(@"Vinay Kumar nadiminti"); Console.WriteLine(reversePara.GetReverseParagraph()); RecursiveExample recObj = new RecursiveExample(); Console.WriteLine(recObj.Getfactorial(5)); recObj.GetFilesAndFoldersInsideTheDiretory(Path.GetDirectoryName(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))); #endregion #region Player pass count test Console.WriteLine("Number of Passes: {0}.", PlayerPassCount.PassCount(5, 3, 2)); Console.ReadKey(); #endregion }
public GenericRepository(Test1232DbContext dbContext) { _dbContext = dbContext; dbSetEntity = _dbContext.Set <TEntity>(); }
public UnitOfWork(Test1232DbContext dbContext) { _dbContext = dbContext; }