public Task GameSettingInfo([FromForm] int?id) { GameSetting setting = id == null ? new GameSetting(): (GameSettingAgent.Instance().GetGameSettingInfo(id.Value) ?? new GameSetting()); return(this.GetResult(setting)); }
public Task SaveSetting([FromForm] int id, [FromForm] GameType?type, [FromForm] string code, [FromForm] string name, [FromForm] string setting, [FromForm] string remark) { if (string.IsNullOrWhiteSpace(name)) { return(this.ShowError("请输入游戏名称")); } if (type == null) { return(this.ShowError("请输入游戏类型")); } GameSetting gamesetting = new GameSetting() { ID = id, Type = type.Value, Code = code, Name = name, Status = GameStatus.Open, MaintainTime = DateTime.MinValue, SettingString = setting, Remark = remark }; return(this.GetResult(GameSettingAgent.Instance().SaveSetting(gamesetting))); }
public Task UpdateIsOpen([FromForm] int id, [FromForm] bool isOpen) { var setting = GameSettingAgent.Instance().GetGameSettingInfo(id); if (setting == null) { return(this.ShowError("记录不存在")); } setting.IsOpen = isOpen; return(this.GetResult(GameSettingAgent.Instance().UpdateIsOpen(setting))); }
public Task GameSettingInfo([FromForm] int?id) { GameSetting setting = id == null ? new GameSetting(): (GameSettingAgent.Instance().GetGameSettingInfo(id.Value) ?? new GameSetting()); IGameProvider iProvider = GameFactory.GetFactory(setting.Type.ToString(), setting.SettingString); return(this.GetResult(new { setting.ID, setting.Name, setting.Code, setting.Type, setting.Status, setting.MaintainTime, setting.Remark, Setting = setting.ID == 0 ? new JsonString("[]") : new JsonString(iProvider.ToSetting()) })); }
public Task SaveSetting([FromForm] int id, [FromForm] int providerId, [FromForm] string name, [FromForm] string type, [FromForm] string category, [FromForm] bool isOpen) { if (string.IsNullOrWhiteSpace(name)) { return(this.ShowError("请输入游戏名称")); } if (string.IsNullOrWhiteSpace(type)) { return(this.ShowError("请输入游戏类型")); } if (string.IsNullOrWhiteSpace(category)) { return(this.ShowError("至少选择游戏分类")); } if (providerId <= 0) { return(this.ShowError("请选择供应商")); } //分类集合 var cate = (GameCategory)0; var arrCategory = category.Split(','); foreach (string item in arrCategory) { cate = cate | item.ToEnum <GameCategory>(); } GameSetting setting = new GameSetting() { ID = id, Name = name, Type = type, Category = cate, IsOpen = isOpen, ProviderID = providerId, Sort = 0 }; return(this.GetResult(GameSettingAgent.Instance().SaveSetting(setting))); }
public Task UpdateStatus([FromForm] int id, [FromForm] GameStatus status, [FromForm] DateTime maintainTime) { var setting = GameSettingAgent.Instance().GetGameSettingInfo(id); if (setting == null) { return(this.ShowError("记录不存在")); } setting.Status = status; if (status == GameStatus.Maintain) { setting.MaintainTime = maintainTime; } else { setting.MaintainTime = DateTime.MinValue; } return(this.GetResult(GameSettingAgent.Instance().UpdateStatus(setting))); }
public Task GameSettingDelete([FromForm] int id) { return(this.GetResult(GameSettingAgent.Instance().DeleteGameSettingInfo(id))); }