public async Task <RuntimeResult> AddAliasAsync(Statistic stat, string alias) { if (_statService.NameOrAliasExists(alias)) { return(StatisticResult.StatisticAlreadyExists()); } stat.Aliases += alias + "/"; await _statService.SaveStatisticAsync(stat); return(GenericResult.FromSuccess("Alias added successfully.")); }
public async Task <RuntimeResult> RenameStatAsync(Statistic stat, string newName) { if (_statService.NameExists(newName)) { return(StatisticResult.StatisticAlreadyExists()); } stat.Name = newName; stat.Aliases = newName + "/"; await _statService.SaveStatisticAsync(stat); return(GenericResult.FromSuccess("Statistic renamed successfully.")); }
public async Task <RuntimeResult> AddSpecialAsync(string name) { if (_statService.NameExists(name)) { return(StatisticResult.StatisticAlreadyExists()); } var newSpecial = new Special { Name = name, Aliases = name + "/" }; await _statService.AddStatisticAsync(newSpecial); return(GenericResult.FromSuccess(Messages.SPECIAL_ADDED)); }