/// <summary> /// تغییر عنوان گروهی /// </summary> /// <param name="NamingModel"></param> /// <returns></returns> public async Task <IActionResult> OnPostAsync(GanjoorBatchNamingModel NamingModel) { await GetInformationAsync(); NumberingModel = new GanjoorNumbering() { Name = Cat.Cat.Title, StartCatId = Cat.Cat.Id, EndCatId = Cat.Cat.Id }; using (HttpClient secureClient = new HttpClient()) { await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response); HttpResponseMessage response = await secureClient.PutAsync($"{APIRoot.Url}/api/ganjoor/cat/recaptionpoems/{Cat.Cat.Id}", new StringContent(JsonConvert.SerializeObject(NamingModel), Encoding.UTF8, "application/json")); if (!response.IsSuccessStatusCode) { LastMessage = JsonConvert.DeserializeObject <string>(await response.Content.ReadAsStringAsync()); } else { RenamingOutput = JsonConvert.DeserializeObject <string[]>(await response.Content.ReadAsStringAsync()); } NamingModel.Simulate = false; } return(Page()); }
public async Task <IActionResult> OnPostNumberingAsync(GanjoorNumbering NumberingModel) { using (HttpClient secureClient = new HttpClient()) { await GanjoorSessionChecker.PrepareClient(secureClient, Request, Response); HttpResponseMessage response = await secureClient.PostAsync($"{APIRoot.Url}/api/numberings", new StringContent(JsonConvert.SerializeObject(NumberingModel), Encoding.UTF8, "application/json")); if (!response.IsSuccessStatusCode) { LastMessage = JsonConvert.DeserializeObject <string>(await response.Content.ReadAsStringAsync()); } } await GetInformationAsync(); NamingModel = new GanjoorBatchNamingModel() { StartWithNotIncludingSpaces = "شمارهٔ ", RemovePreviousPattern = true, RemoveSetOfCharacters = ".-", Simulate = true }; return(Page()); }
public async Task <IActionResult> OnGetAsync() { if (string.IsNullOrEmpty(Request.Cookies["Token"])) { return(Redirect("/")); } LastMessage = Request.Query["edit"] == "true" ? "ویرایش انجام شد." : ""; if (string.IsNullOrEmpty(Request.Query["url"])) { return(StatusCode(StatusCodes.Status500InternalServerError, "نشانی صفحه مشخص نیست.")); } await GetInformationAsync(); NamingModel = new GanjoorBatchNamingModel() { StartWithNotIncludingSpaces = "شمارهٔ ", RemovePreviousPattern = true, RemoveSetOfCharacters = ".-", Simulate = true }; NumberingModel = new GanjoorNumbering() { Name = Cat.Cat.Title, StartCatId = Cat.Cat.Id, EndCatId = Cat.Cat.Id }; return(Page()); }