public async Task CreateClan([Remainder] string clanName) { if (Context.Message.Content.Contains("<") && Context.Message.Content.Contains(">")) { await Context.Channel.SendMessageAsync("", embed : Utility.ResultFeedback(Utility.RedFailiureEmbed, Utility.SuccessLevelEmoji[2], "Please don't include any emotes! Anything with `<` and `>`")); return; } if (clanName.Length > 20) { await Context.Channel.SendMessageAsync("", embed : Utility.ResultFeedback(Utility.RedFailiureEmbed, Utility.SuccessLevelEmoji[2], "Clan Name should not exceed 20 characters!")); return; } if (clanName.Length < 3) { await Context.Channel.SendMessageAsync("", embed : Utility.ResultFeedback(Utility.RedFailiureEmbed, Utility.SuccessLevelEmoji[2], "Clan Name should at least have 3 characters!")); return; } await _clanService.CreateClan(Context, clanName.Trim()); }
public async Task <IActionResult> Post([FromBody] ClanCreateView clanCreateView) { if (HttpContext.TryGetCurrentSession(out AccountSessionView accountSessionView)) { return(Ok(await ClanService.CreateClan(accountSessionView.AccountID, clanCreateView))); } return(Ok(ValidatedView.Invalid(ErrorCode.OPERATION_FAILED))); }
protected void Create() { Loading = true; StateHasChanged(); if (!ClanService.CreateClan(new ClanCreateView { Tag = Tag, Name = Name, Description = Description }, out string message, out HttpStatusCode code)) { NotificationService.ShowError(message, "Failed to create clan!"); if (code == HttpStatusCode.Unauthorized) { ComponentService.Show(new Login()); } else { Loading = false; } }