public JsonResult SelectPotion(int id) { var context = new PCContext(); var potion = context.Potions .Where(m => m.Id == id) .FirstOrDefault(); if (potion != null) { WebSocketManager.Broadcast(new ServerMessage() { Command = ServerMessage.Commands.Selected, Content = POTION_HTML_ID_PREFIX + id }); if (!potion.Selected) { potion.Selected = true; context.SaveChanges(); } return(Json(new JsonResponse <string>() { Code = 200, Result = potion.Description }, JsonRequestBehavior.AllowGet)); } else { return(Json(new JsonResponse <string>() { Code = 404, Result = "Not found" }, JsonRequestBehavior.AllowGet)); } }
protected void Application_Start(object sender, EventArgs e) { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); Components.WebSocketManager wsh = new Components.WebSocketManager(); using (PCContext context = new PCContext()) { } }
public ActionResult PotionsGrid() { var context = new PCContext(); var potions = context.Potions.ToList(); decimal cols = 12; decimal count = (decimal)potions.Count; int rows = (int)Math.Ceiling(count / cols); ViewBag.potionsGrid = new List <List <Potion> >(rows); int rowIndex = -1; for (int i = 0, iMax = potions.Count; i < iMax; i++) { if (i % cols == 0) { rowIndex++; ViewBag.potionsGrid.Add(new List <Potion>()); } ViewBag.potionsGrid[rowIndex].Add(potions.ElementAt(0)); potions.RemoveAt(0); } return(PartialView("_PotionsGrid")); }
public HomeController(PCContext context) { _context = context; }
public CategoryService(PCContext pCContext) { _context = pCContext; }
public CourseService(PCContext pCContext) { _context = pCContext; }
public ProductController(PCContext context) { _context = context; }