public ActionResult Add(long Template = -1) { AddEditGaiaViewModel vModel = new AddEditGaiaViewModel(Template) { AuthedUser = UserManager.FindById(User.Identity.GetUserId()) }; return(View("~/Views/GameAdmin/Gaia/Add.cshtml", vModel)); }
public ActionResult Edit(long id, string ArchivePath = "") { IGaiaTemplate obj = TemplateCache.Get <IGaiaTemplate>(id); if (obj == null) { return(RedirectToAction("Index", new { Message = "That does not exist" })); } AddEditGaiaViewModel vModel = new AddEditGaiaViewModel(ArchivePath, obj) { AuthedUser = UserManager.FindById(User.Identity.GetUserId()) }; return(View("~/Views/GameAdmin/Gaia/Edit.cshtml", vModel)); }
public ActionResult Add(AddEditGaiaViewModel vModel) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IGaiaTemplate newObj = vModel.DataObject; string message; if (newObj.Create(authedUser.GameAccount, authedUser.GetStaffRank(User)) == null) { message = "Error; Creation failed."; } else { LoggingUtility.LogAdminCommandUsage("*WEB* - AddGaiaTemplate[" + newObj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Creation Successful."; } return(RedirectToAction("Index", new { Message = message })); }
public ActionResult Edit(long id, AddEditGaiaViewModel vModel) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IGaiaTemplate obj = TemplateCache.Get <IGaiaTemplate>(id); string message; if (obj == null) { message = "That does not exist"; return(RedirectToAction("Index", new { Message = message })); } try { obj.Name = vModel.DataObject.Name; obj.CelestialBodies = vModel.DataObject.CelestialBodies; obj.ChronologicalSystem = vModel.DataObject.ChronologicalSystem; obj.Qualities = vModel.DataObject.Qualities; obj.RotationalAngle = vModel.DataObject.RotationalAngle; if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - EditGaiaTemplate[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Edit Successful."; } else { message = "Error; Edit failed."; } } catch { message = "Error; Edit failed."; } return(RedirectToAction("Index", new { Message = message })); }