12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- @page "/AddData"
- @using System.Net.Http
- @using Microsoft.AspNetCore.Authorization
- @using Microsoft.AspNetCore.Components.Forms
- @using Microsoft.AspNetCore.Components.Routing
- @using Microsoft.AspNetCore.Components.Web
- @using Microsoft.JSInterop
- @inject NavigationManager NavigationManager
- @using System.Text.RegularExpressions;
- @using Newtonsoft.Json;
- @inject NavigationManager NavigationManager
- @{
- CheckConnect();
- void CheckConnect()
- {
- if (BlazorApp.Classasync.userautorisate == false)
- {
- NavigationManager.NavigateTo("Authorization");
- }
- }
- }
- <head>
- <link href="/css/autorizastion.css" rel="stylesheet" />
- </head>
- <div class="registration-cssave">
- <form>
- <h3 class="text-center">Добавление области и получателя обращения</h3>
- <div class="form-group">
- <input @bind="region" class="form-control item" type="text" name="username" maxlength="15" minlength="1" pattern="^[a-zA-Z0-9_.-]*$" id="username" placeholder="Область" required>
- </div>
- <div class="form-group">
- <input @bind="apeal" class="form-control item" type="text" name="Пароль" minlength="1" id="password" placeholder="Получатель обращения" required>
- </div>
- <div class="form-group">
- <button type=button @onclick="regionandapealUpdate">Добавить</button>
- </div>
- @code {
- string region;
- string apeal;
- public async Task regionandapealUpdate()
- {
- BlazorApp.Classasync.addStatus = "";
- if ((region != null) && (region != ""))
- {
- await BlazorApp.Classasync.AddRegion(region);
- BlazorApp.Classasync.addStatus = "регион успешно добавлен";
- }
- if ((apeal != null) && (apeal != ""))
- {
- await BlazorApp.Classasync.AddResiple(apeal);
- BlazorApp.Classasync.addStatus = "получатель успешно добавлен";
- }
- if (((region != null) && (apeal != null)) && (region != "") && (apeal != ""))
- {
- BlazorApp.Classasync.addStatus = "Регион и получатель успешно добавлены";
- }
- else if ((region == null) && (apeal == null)&&(region == "") && (apeal == ""))
- {
- BlazorApp.Classasync.addStatus = "Вы ничего не ввели";
- }
-
- }
- }
- <p text-center>@BlazorApp.Classasync.addStatus</p>
-
- </form>
- </div>
|