public ActionResult AdminLadders_Delete([DataSourceRequest] DataSourceRequest request, AdminLaddersViewModel model)
        {
            if (model != null && model.Name != null)
            {
                Ladder destroyedLadder = Ladder.LoadById(model.Id);
                destroyedLadder.Name = model.Name;
                destroyedLadder.Delete();
            }

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }
        public ActionResult AdminLadders_Update([DataSourceRequest] DataSourceRequest request, AdminLaddersViewModel model)
        {
            if (model != null && model.Name != null)
            {
                // Still need to decide what all the grid needs to show
                Ladder updatedLadder = Ladder.LoadById(model.Id);
                updatedLadder.Name = model.Name;
                updatedLadder.Description = model.Description;
                updatedLadder.isActive = model.isActive;
                updatedLadder.Save();
            }

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }
Пример #3
0
        public ActionResult AdminLadders_Update([DataSourceRequest] DataSourceRequest request, AdminLaddersViewModel model)
        {
            // for updating ladders.
            // will only accept changes for Ladder Description and Activity currently
            if (model != null && ModelState.IsValid)
            {
                Ladder updatedLadder = Ladder.LoadById(model.Id);
                updatedLadder.Description = model.Description;
                updatedLadder.isActive = model.isActive;
                updatedLadder.LowerChallengeLimit = model.LowerChallengeLimit;
                updatedLadder.UpperChallengeLimit = model.UpperChallengeLimit;
                updatedLadder.MaxPendingChallenges = model.MaxPendingChallenges;
                updatedLadder.MaxInactiveDays = model.MaxInactiveDays;
                updatedLadder.Save();
            }

            return Json(new[] { model }.ToDataSourceResult(request, ModelState));
        }