Пример #1
0
        public static void Initialize(PhotoStudioContext context)
        {
            bool created = context.Database.EnsureCreated();

            var category = new Category[]
            {
                new Category{Name = "Фотостудии"},
                new Category{Name = "Бронирование"},
                new Category{Name = "Фотошкола"},
                new Category{Name = "Фотосессии"}
            };
            foreach (Category b in category)
            {
                context.Category.Add(b);
            }
            context.SaveChanges();

            var service = new Service[]
            {
                new Service { Name = "MANSARDA", CategoryId = 11, Price = 0 },
                new Service { Name = "STALINKA", CategoryId = 11, Price = 0 },
                new Service { Name = "Cherdack", CategoryId = 12, Price = 500 },
                new Service { Name = "Ballet", CategoryId = 12, Price = 500 },
                new Service { Name = "Начальный уровень фотошколы", CategoryId = 13, Price = 1500 },
                new Service { Name = "Продвинутый уровень фотошколы", CategoryId = 13, Price = 1500 },
                new Service { Name = "Новогодняя", CategoryId = 14, Price = 600 },
                new Service { Name = "Модельная", CategoryId = 14, Price = 750 }
            };

            foreach (Service p in service)
            {
                context.Service.Add(p);
            }
            context.SaveChanges();
        }
Пример #2
0
        public ApplicationViewModel()
        {
            db = new PhotoStudioContext();

            db.Orders.Load();
            db.Clients.Load();
            db.Services.Load();

            db.SaveChanges();

            foreach (Order order in db.Orders.Local.ToList())
            {
                Orders.Add(order);
            }

            foreach (Client client in db.Clients.Local.ToList())
            {
                Clients.Add(client);
            }

            foreach (Service service in db.Services.Local.ToList())
            {
                Services.Add(service);
            }
        }
Пример #3
0
 [OperationBehavior(TransactionScopeRequired = true)] // roll back if there is a problem
 public void SubmitPrintOrder(Entities.PrintOrder order)
 {
     using (var db = new PhotoStudioContext())
     {
         db.Database.Log = Console.WriteLine;
         db.SubmitOrder(order);
         Console.WriteLine("Request: Order {0} for client {1} received, printing {2} photos", order.OrderId, order.CustomerName, order.OrderItems.Count());
     }
 }
        public ServicesController(PhotoStudioContext context)
        {
            _context = context;
            if (_context.Service.Count() == 0)
            {
                _context.Service.Add(new Service {
                    Name = "MANSARDA", Price = 500, CategoryId = 1
                });

                _context.SaveChanges();
            }
        }
Пример #5
0
 public CategoryController(PhotoStudioContext context)
 {
     _context = context;
     if (_context.Category.Count() == 0)
     {
         _context.Category.Add(new Category {
             Name = "Фотостудии"
         });
         //_context.Category.Add(new Category { Name = "ghj" });
         _context.SaveChanges();
     }
 }
Пример #6
0
        public List <Entities.Photo> GetPhotos()
        {
            Console.WriteLine("Request: Get Photos");

            List <Entities.Photo> photos;

            using (var db = new PhotoStudioContext())
            {
                db.Database.Log = Console.WriteLine;
                photos          = db.GetAvailablePhotos();
            }

            return(photos);
        }
Пример #7
0
 public HomeController(ILogger <HomeController> logger, PhotoStudioContext context)
 {
     _logger  = logger;
     _context = context;
 }
Пример #8
0
 public ClientsModel(PhotoStudioContext context)
 {
     _context = context;
 }
Пример #9
0
 public ClientsController(PhotoStudioContext context)
 {
     _context = context;
 }
Пример #10
0
 public IndexModel(PhotoStudioContext context)
 {
     Context = context;
 }
Пример #11
0
 public OrdersController(PhotoStudioContext context)
 {
     _context = context;
 }
Пример #12
0
 public OptionsModel(PhotoStudioContext context)
 {
     _context = context;
 }
Пример #13
0
 public OptionsController(PhotoStudioContext context)
 {
     _context = context;
 }
Пример #14
0
 public DeleteModel(Lab5.Models.PhotoStudioContext context)
 {
     _context = context;
 }
Пример #15
0
 public IndexModel(ILogger <IndexModel> logger, PhotoStudioContext context)
 {
     _logger = logger;
     Context = context;
 }