public ActionResult Details(int id, GameMapVariant model) { var variant = GameMapService.GetVariant(id); variant.Title = model.Title; variant.ShortDescription = model.ShortDescription; variant.Description = model.Description; variant.MinPlayers = model.MinPlayers; variant.MaxPlayers = model.MaxPlayers; variant.IsStaffPick = model.IsStaffPick; if (ModelState.IsValid) { string path = System.IO.Path.Combine(Server.MapPath("~/Content/Files/Forge/"), variant.File.FileName); using (FileStream stream = System.IO.File.Open(path, FileMode.Open)) { VariantLib.ForgeVariant forge = new VariantLib.ForgeVariant(stream); forge.VariantDescription = variant.ShortDescription; forge.VariantName = variant.Title; forge.Save(); } GameMapService.Save(); this.SetAlert(string.Format("The variant '{0}' has been updated.", variant.Title), AlertType.Success); return RedirectToAction("Index"); } return View(variant); }
public ActionResult Delete(int id, GameMapVariant model) { var variant = GameMapService.GetVariant(id); variant.IsDeleted = !variant.IsDeleted; GameMapService.Save(); this.SetAlert(string.Format("The variant '{0}' has been deleted.", variant.Title), AlertType.Success); return RedirectToAction("Index"); }