public void Test_GetStore() { var options = new DbContextOptionsBuilder <StoreContext>() .UseInMemoryDatabase(databaseName: "TestDb13") .Options; using (var context = new StoreContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); StoreRepository storeRepo = new StoreRepository(context); StoreLogic sl = new StoreLogic(storeRepo); AStore store1 = new AStore(); store1.Name = "Store1"; context.Add <AStore>(store1); context.SaveChanges(); AStore stores = sl.GetStore(store1.StoreID); Assert.Equal(store1.Name, stores.Name); } }
public void Test_AddNewComp() { var options = new DbContextOptionsBuilder <StoreContext>() .UseInMemoryDatabase(databaseName: "TestDb14") .Options; using (var context = new StoreContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); StoreRepository storeRepo = new StoreRepository(context); StoreLogic sl = new StoreLogic(storeRepo); AStore store = new AStore(); store.Name = "Store1"; ItemType item = new ItemType("toppings"); APizzaComponent testComp = new APizzaComponent("test", item); context.Add <AStore>(store); context.Add <ItemType>(item); context.Add <APizzaComponent>(testComp); context.SaveChanges(); RawNewComp rawTest = new RawNewComp(); rawTest.ID = store.StoreID; rawTest.ItemID = item.TypeID; rawTest.ItemName = item.Name; rawTest.CompName = "testcomp"; rawTest.Price = 0; Assert.True(sl.AddNewComp(rawTest)); } }
public MainWindow() { InitializeComponent(); Loaded += MainWindow_Loaded; _storeLogic = StoreLogic.Instance; _booksService = new BooksService(); }
public void Test_GetStoreToppings() { var options = new DbContextOptionsBuilder <StoreContext>() .UseInMemoryDatabase(databaseName: "TestDb15") .Options; using (var context = new StoreContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); StoreRepository storeRepo = new StoreRepository(context); StoreLogic sl = new StoreLogic(storeRepo); AStore store1 = new AStore(); store1.Name = "Store1"; ItemType type = new ItemType("testtype"); APizzaComponent comp = new APizzaComponent("testcomp", type); Topping testtopping = new Topping(store1, 0, 0, comp); context.Add <AStore>(store1); context.Add <Topping>(testtopping); context.SaveChanges(); List <Topping> toppings = sl.GetStoreToppings(store1.StoreID); Assert.Equal(testtopping.PizzaType.Name, toppings[0].PizzaType.Name); } }
public ActionResult Edit(StoreViewModel model) { if (ModelState.IsValid) { StoreLogic.EditStore(model); return(Json(new { IsSucceeded = true })); } return(Json(new { IsSucceeded = false })); }
/// <summary> /// 用于初始化 /// </summary> private void Init() { canvas = GameObject.FindObjectOfType <Canvas>(); UICamera = GameObject.Find("UICamera").GetComponent <Camera>(); canvasGroup = GetComponent <CanvasGroup>(); storeLogic = new StoreLogic(); BindButtonEvent(); BindCanBuyButtonEvent(); Reveal(); }
public static void Main(string[] args) { RegisterEntities(); var dir_name = StoreLogic.GetDirection(); if (!Directory.Exists(dir_name)) { Directory.CreateDirectory(dir_name); } CreateHostBuilder(args).Build().Run(); }
public ActionResult Delete(int id) { try { StoreLogic.DeleteStore(id); return(Json(new { IsSucceeded = true })); } catch { return(Json(new { IsSucceeded = false })); } }
public void Test_AddNewPizza() { var options = new DbContextOptionsBuilder <StoreContext>() .UseInMemoryDatabase(databaseName: "TestDb16") .Options; using (var context = new StoreContext(options)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); StoreRepository storeRepo = new StoreRepository(context); StoreLogic sl = new StoreLogic(storeRepo); AStore store = new AStore(); store.Name = "Store1"; ItemType item = new ItemType("toppings"); APizzaComponent testCrust = new APizzaComponent("testcrust", item); APizzaComponent testTopping = new APizzaComponent("testtopping", item); Crust tempCrust = new Crust(store, 0, 1, testCrust); Topping tempTopping = new Topping(store, 0, 1, testTopping); context.Add <AStore>(store); context.Add <ItemType>(item); context.Add <APizzaComponent>(testCrust); context.Add <APizzaComponent>(testTopping); context.Add <Crust>(tempCrust); context.Add <Topping>(tempTopping); context.SaveChanges(); RawComp rawCrust = new RawComp(); rawCrust.ID = tempCrust.CrustID; rawCrust.Inventory = 0; rawCrust.Name = "testcrust"; rawCrust.Price = 0; RawComp rawTopping = new RawComp(); rawTopping.ID = tempTopping.ToppingID; rawTopping.Inventory = 0; rawTopping.Name = "testtopping"; rawTopping.Price = 0; RawNewPizza rawTest = new RawNewPizza(); rawTest.ID = store.StoreID; rawTest.Name = "testpizza"; rawTest.Crust = rawCrust; rawTest.AllToppings = new List <RawComp>(); rawTest.AllToppings.Add(rawTopping); Assert.True(sl.AddNewPizza(rawTest)); } }
public async Task <ActionResult> ContentGet(Guid id) { //Возращает либо пдф, либо ошибку //return Ok(); //if (String.IsNullOrEmpty(id)) return new NoContentResult(); var path = StoreLogic.GetFullName($"{id}.pdf"); if (System.IO.File.Exists(path)) { FileStream stream = null; stream = new FileStream(path, FileMode.Open); return(new FileStreamResult(stream, "application/pdf")); } return(new ObjectResult(new NotFoundDTO())); }
private void ExecuteUpdateCommand() { Store store = StoreModel.GetAsStore(); if (store != null) { StoreLogic storeLogic = new StoreLogic(); var res = storeLogic.UpdateStore(store); switch (res) { case StoreLogic.Status.DBError: SnackbarMessageQueue.Enqueue("Error occur, Can not add store now..."); break; case StoreLogic.Status.Success: SnackbarMessageQueue.Enqueue(string.Format("{0} Updated successful.", store.Name)); break; } } }
public async Task <ActionResult> ContentSet(Guid id) { //метод найдет хранимый документ и привяжет к нему содержимое. вернёт ОК или ошибку //return Ok(); // CriteriaOperator criteria = new BinaryOperator(nameof(EcmDocument.ObjectId), id.ToString()); var doc = ObjectSpace.FindObject <EcmDocument>(criteria); if (!doc.IsLoaded) { var path = StoreLogic.GetFullName($"{id}.pdf"); using (FileStream stream = System.IO.File.Create(path)) { await Request.Body.CopyToAsync(stream); } doc.IsLoaded = true; return(Ok()); } return(new NotFoundResult()); }
private static void _LowHealth() { if (_bot.CurrentHealth > 2) { return; } PackAsset stagecoach = _bot.Hand.Find(card => card.CardName == ECardName.Stagecoach); PackAsset wellsFargo = _bot.Hand.Find(card => card.CardName == ECardName.WellsFargo); if (wellsFargo != null) { GetCardsLogic.StageCoach(_bot, wellsFargo); _bot.UsingCard(wellsFargo); } else if (stagecoach != null) { GetCardsLogic.StageCoach(_bot, stagecoach); _bot.UsingCard(stagecoach); } PackAsset store = _bot.Hand.Find(card => card.CardName == ECardName.Store); if (store != null) { StoreLogic.Store(_bot, store); _bot.UsingCard(store); } PackAsset saloon = _bot.Hand.Find(card => card.CardName == ECardName.Saloon); if (_bot.CurrentHealth == 1 && saloon != null) { SaloonLogic.Saloon(_bot, saloon); _bot.UsingCard(saloon); } }
public ActionResult Create(StoreViewModel model) { StoreLogic.CreateNewStore(model); return(RedirectToAction("Index")); }
public JsonResult GetbyId(int id) { var model = StoreLogic.GetStoreById(id); return(Json(model, JsonRequestBehavior.AllowGet)); }
public JsonResult GetStores() { var model = StoreLogic.GetAllStores(); return(Json(model, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(StoreViewModel model) { StoreLogic.EditStore(model); return(RedirectToAction("Index")); }
// GET: Stores/Delete/5 public ActionResult Delete(int id) { var model = StoreLogic.GetStoreById(id); return(View(model)); }
public ActionResult Delete(StoreViewModel model) { StoreLogic.DeleteStore(model.Id); return(RedirectToAction("Index")); }
// GET: Stores public ActionResult Index() { var model = StoreLogic.GetAllStores(); return(View(model)); }
public IHttpActionResult GetStores() { return(Ok(StoreLogic.GetStores())); }
public StoreController(StoreLogic sL) { storeLogic = sL; }