Example #1
0
        public ActionResult Uploading(string id)
        {
            using (var dm = new DataManager())
            {
                Config config = dm.GetConfig(id);
                ViewBag.CellSize = config.CellSize;
                ViewBag.Name = config.Name;
                ViewBag.Min = config.Min;
                ViewBag.Max = config.Max;
                ViewBag.Spawn = config.Spawn;
                var cells = dm.GetCells(config.ConfigId);
                var X = new int[cells.Length];
                var Y = new int[cells.Length];
                for (int i = 0; i < cells.Length; i++)
                {
                    if (cells[i].ConfigId != config.ConfigId)
                        continue;

                    X[i] = cells[i].X;
                    Y[i] = cells[i].Y;
                }

                ViewBag.X = new JavaScriptSerializer().Serialize(X);
                ViewBag.Y = new JavaScriptSerializer().Serialize(Y);
            }
            return View("Index");
        }
Example #2
0
 public ActionResult Save(string name,int cellSize, int min, int max, int spawn, int[][] grid)
 {
     using (var dm = new DataManager())
     {
         dm.SaveConfig(name,cellSize, min, max, spawn, grid, User.Identity.GetUserId());
     }
     return RedirectToAction("Index","Home");
 }
Example #3
0
 public ActionResult GivePower(string id)
 {
     var dm = new DataManager();
     var user = dm.GetUser(u => u.Id == id);
     user.Role = 1;
     dm.ModifyUser(user);
     return RedirectToAction("ManageUsers");
 }
Example #4
0
        //
        // GET: /User/
        public ActionResult ChangeTheme(string theme)
        {
            DataManager dm = new DataManager();
            ApplicationUser user = dm.GetUser(u => u.Id == User.Identity.GetUserId());
            user.Theme = "~/Content/" + theme + ".min.css";
            dm.ModifyUser(user);

            return RedirectToAction("Index", "Home");
        }
Example #5
0
        public ActionResult Load()
        {
            var model = new ConfigsModel();
            using (var dm = new DataManager())
            {
                model.Configs = dm.GetConfigs();
            }

            return View(model);
        }
Example #6
0
 private bool ConfirmAccount(string confirmationToken)
 {
     var dm = new DataManager();
     ApplicationUser user = dm.GetUser(u => u.ConfirmationToken == confirmationToken);
     if (user != null)
     {
         user.IsConfirmed = true;
         user.Role = 2;
         dm.ModifyUser(user);
         return true;
     }
     return false;
 }