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(); }
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); } }
[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(); } }
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(); } }
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); }
public HomeController(ILogger <HomeController> logger, PhotoStudioContext context) { _logger = logger; _context = context; }
public ClientsModel(PhotoStudioContext context) { _context = context; }
public ClientsController(PhotoStudioContext context) { _context = context; }
public IndexModel(PhotoStudioContext context) { Context = context; }
public OrdersController(PhotoStudioContext context) { _context = context; }
public OptionsModel(PhotoStudioContext context) { _context = context; }
public OptionsController(PhotoStudioContext context) { _context = context; }
public DeleteModel(Lab5.Models.PhotoStudioContext context) { _context = context; }
public IndexModel(ILogger <IndexModel> logger, PhotoStudioContext context) { _logger = logger; Context = context; }