Пример #1
0
        public void Add(RegisteredVehicle vehicle)
        {
            DataContext1 context = new DataContext1();

            context.RegisteredVehicles.Add(vehicle);
            context.SaveChanges();
        }
Пример #2
0
 public UnitOfWork(DataContext1 dataContext1, DataContext2 dataContext2)
 {
     _dataContext1     = dataContext1;
     _dataContext2     = dataContext2;
     UserRepository    = new UserRepository(dataContext1);
     ProductRepository = new ProductRepository(dataContext2);
 }
        public void Delete(Manufacturer manufacturer)
        {
            DataContext1 context = new DataContext1();

            context.Manufacturers.Remove(manufacturer);
            context.SaveChanges();
        }
Пример #4
0
        public DbSet <RegisteredVehicle> CollectRegisteredVehicleList()
        {
            DataContext1 context = new DataContext1();
            var          list    = context.RegisteredVehicles;

            return(list);
        }
Пример #5
0
        public RegisteredVehicle Find(Guid id)
        {
            DataContext1 context = new DataContext1();
            var          item    = context.RegisteredVehicles.First <RegisteredVehicle>(m => m.Id == id);

            return(item);
        }
        public void AddManufacturer(Manufacturer manufacturer)
        {
            DataContext1 context = new DataContext1();

            context.Manufacturers.Add(manufacturer);
            context.SaveChanges();
        }
        public void Add(Category category)
        {
            DataContext1 context = new DataContext1();

            context.Categories.Add(category);
            context.SaveChanges();
        }
        public Category Find(Guid id)
        {
            DataContext1 context = new DataContext1();
            var          item    = context.Categories.First <Category>(m => m.Id == id);

            return(item);
        }
        public void Update(Manufacturer manfacturer)
        {
            DataContext1 context = new DataContext1();
            var          found   = context.Manufacturers.First(m => m.Id == manfacturer.Id);

            found.Name = manfacturer.Name;
            context.SaveChanges();
        }
Пример #10
0
        public void Delete(Guid id)
        {
            DataContext1 context = new DataContext1();
            var          item    = context.RegisteredVehicles.First(m => m.Id == id);

            context.Remove(item);
            context.SaveChanges();
        }
        public void Delete(Guid id)
        {
            DataContext1 context = new DataContext1();
            var          item    = Find(id);

            context.Categories.Remove(item);
            context.SaveChanges();
        }
Пример #12
0
        public void Update(RegisteredVehicle vehicle)
        {
            DataContext1 context = new DataContext1();
            var          item    = Find(vehicle.Id);

            item = vehicle;
            context.Update(item);
            context.SaveChanges();
        }
        public List <Manufacturer> CollectManufacturerList()
        {
            DataContext1        context = new DataContext1();
            List <Manufacturer> list    = new List <Manufacturer>();

            list = context.Manufacturers.OrderBy(m => m.Name).ToList();

            return(list);
        }
        public Manufacturer Find(Guid id)
        {
            DataContext1 context           = new DataContext1();
            var          foundManufacturer = new Manufacturer();

            foundManufacturer = context.Manufacturers.First <Manufacturer>(m => m.Id == id);

            return(foundManufacturer);
        }
        public void Update(Category category)
        {
            DataContext1 context = new DataContext1();
            var          item    = Find(category.Id);

            item = category;
            context.Update(item);
            context.SaveChanges();
        }
        public List <Category> CollectCategoryList()
        {
            DataContext1    context = new DataContext1();
            List <Category> result  = new List <Category>();

            result = context.Categories.OrderBy(m => m.StartRange).ToList();

            return(result);
        }
Пример #17
0
 public UnitOfWork(DataContext1 dataContext1, DataContext2 dataContext2, DataContext3 dataContext3)
 {
     _dataContext1      = dataContext1;
     _dataContext2      = dataContext2;
     _dataContext3      = dataContext3;
     UserRepository     = new UserRepository(dataContext1);
     UserLogRepository  = new UserLogRepository(dataContext2);
     CategoryRepository = new CategoryRepository(dataContext3);
     ProductRepository  = new ProductRepository(dataContext3);
 }
Пример #18
0
        static void Main()
        {
            using (var db = new DataContext())
            {
                db.Database.Migrate();
            }
            using (var db1 = new DataContext1())
            {
                db1.Database.Migrate();
            }



            ConfigureServices();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            LoginForm = new LoginForm();
            Application.Run(LoginForm);
        }
Пример #19
0
 public BuildReal()
 {
     this.DataContext = new DataContext1();
 }
Пример #20
0
 public SellingContentsRep1(DataContext1 context)
 {
     _context = context;
 }
Пример #21
0
 public ItemRep1(DataContext1 context)
 {
     _context = context;
 }
Пример #22
0
 public EmployeeRep1(DataContext1 context)
 {
     _context = context;
 }