Commit bd2baa18 authored by ferhat tamer's avatar ferhat tamer 💬
Browse files

Initial commit

parents
<Router AppAssembly="@typeof(App).Assembly">
<Found Context="routeData">
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
<FocusOnNavigate RouteData="@routeData" Selector="h1" />
</Found>
<NotFound>
<PageTitle>Not found</PageTitle>
<LayoutView Layout="@typeof(MainLayout)">
<p role="alert">Sorry, there's nothing at this address.</p>
</LayoutView>
</NotFound>
</Router>
namespace ex9.Data;
public class WeatherForecast
{
public DateTime Date { get; set; }
public int TemperatureC { get; set; }
public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
public string? Summary { get; set; }
}
namespace ex9.Data;
public class WeatherForecastService
{
private static readonly string[] Summaries = new[]
{
"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
};
public Task<WeatherForecast[]> GetForecastAsync(DateTime startDate)
{
return Task.FromResult(Enumerable.Range(1, 5).Select(index => new WeatherForecast
{
Date = startDate.AddDays(index),
TemperatureC = Random.Shared.Next(-20, 55),
Summary = Summaries[Random.Shared.Next(Summaries.Length)]
}).ToArray());
}
}
@page
@model ex9.Pages.ErrorModel
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title>Error</title>
<link href="~/css/bootstrap/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/site.css" rel="stylesheet" asp-append-version="true" />
</head>
<body>
<div class="main">
<div class="content px-4">
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays detailed information about the error that occurred.
</p>
<p>
<strong>The Development environment shouldn't be enabled for deployed applications.</strong>
It can result in displaying sensitive information from exceptions to end users.
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong>
and restarting the app.
</p>
</div>
</div>
</body>
</html>
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace ex9.Pages;
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string? RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
@page "/"
@inherits ControlBase
@* All Validation messages are displayed where you place*@
@inject NavigationManager NavigationManager
<style>
* {
margin: 0;
padding: 0;
text-decoration: none;
font-family: sans-serif;
box-sizing: border-box;
}
body {
width: 100%;
height: 100%;
}
.kutu {
width: 400px;
background: white;
height: 700px;
padding: 80px 40px;
border-style: solid;
/*sağdan soldan 40px yukarıdan aşağıdan 80 px padding*/
border-radius: 10px;
/*köşleri ovalleştirme*/
position: absolute;
left: 58%;
/*soldan hizalama*/
top: 50%;
/*yukarıdan hizalama*/
transform: translate(-50%, -50%);
/*tam hizalama sağlamak için*/
}
.txtb {
/*alt çizgi ekleme*/
position: relative;
margin: 30px 0;
}
.txtb input {
font-size: 15px;
color: #333;
border: none;
width: 100%;
outline: none;
background: none;
padding: 0 5px;
height: 40px;
border-bottom: 2px solid #adadad;
}
img.adminimg {
margin-left: 30px;
margin-bottom: 50px;
display: block;
background: black;
border-radius: 25%;
width: 250px;
height: 200px;
}
.logbtn {
display: block;
width: 100%;
height: 50px;
border: none;
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, black 70%);
background-size: 200%;
color: white;
outline: none;
/*köşelerini kapatmak siyah olmamsı için*/
cursor: pointer;
border-radius: 15px;
}
.logbtn:hover {
background: white;
color: black;
border: 2px solid black;
}
</style>
<body>
<div class="kutu">
<div class="contact-form">
<img src="images/kitap.jpg" class="adminimg">
<h2>Giriş Yap </h2>
<form>
<div class="txtb">
<input type="text" placeholder="Username" @bind="inputKullaniciAdi" minlength="8" required />
</div>
<div class="txtb">
<input type="password" placeholder="Password" minlength="8" @bind="inputPassword" required />
</div>
<input type="button" class="logbtn" value="Giriş Yap" @onclick="SearchUser" />
<br><input type="button" class="logbtn" value="Kaydol" onclick="window.location.href ='/Sıgn'" />
</form>
</div>
</div>
</body>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components;
using System.Diagnostics;
using System.Globalization;
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
using Microsoft.JSInterop;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Net.Http;
using Microsoft.Data.SqlClient;
using System.ComponentModel.DataAnnotations;
using System.Data;
namespace ex9.Pages
{
public class User
{
public int Id { get; set; } = 1;
public string? KullaniciAdi { get; set; }
public string? Password { get; set; }
public string? Role;
}
public class ControlBase : ComponentBase
{
static string connectionString = ("Server=.;Database=PdfApp;Encrypt=False;Integrated Security=SSPI;");
static SqlConnection conn = new SqlConnection(connectionString);
static string sql = "select Id,Ad,Soyad,KullaniciAdi,Password,Role from Login";
static SqlDataAdapter daps = new SqlDataAdapter(sql, conn);
SqlCommandBuilder cb = new SqlCommandBuilder(daps);
DataSet dsps = new DataSet();
public List<User> kullanici = new List<User>();
public string? inputId { get; set; }
public string? error { get; set; }
//[Required(ErrorMessage = "Please enter your user Id")]
//[StringLength(16,ErrorMessage ="The user ıd to long")]
public string? inputKullaniciAdi { get; set; }
public string? inputPassword { get; set; }
[Inject]
protected NavigationManager? Navigation { get; set; }
[Inject]
public ProtectedLocalStorage? localstr { get; set; }
public string? Text { get; set; }
public async Task SearchUser()
{
DataRowCollection itemColumns = dsps.Tables[0].Rows;
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
if (dsps.Tables[0].Rows[i]["KullaniciAdi"].ToString() == inputKullaniciAdi && dsps.Tables[0].Rows[i]["Password"].ToString() == inputPassword)
{
/*Text=inputKullaniciAdi;
NavigationManeger.NavigateTo("/giris"+inputKullaniciAdi,inputPassword);*/
//locale veri at
await localstr.SetAsync("myUser", dsps.Tables[0].Rows[i]["Role"].ToString());//kullanci adi changed role
Navigation.NavigateTo("/Giris");
}
else
{
}
}
}
protected override async Task OnInitializedAsync()
{
kullanici.Clear();
await selectproc();
}
public Task selectproc()
{
return Task.Run(() =>
{
try
{
daps.Fill(dsps, "kullanici");
error += dsps.Tables[0].Rows.Count.ToString();
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
User xm = new User();
xm.KullaniciAdi = dsps.Tables[0].Rows[i]["KullaniciAdi"].ToString();
xm.Password = dsps.Tables[0].Rows[i]["Password"].ToString();
xm.Role = dsps.Tables[0].Rows[i]["Role"].ToString();
kullanici.Add(xm);
}
}
catch (Exception ex)
{
error = ex.ToString();
}
});
}
}
}
\ No newline at end of file
@page "/Kayit"
@inherits KayıtBase
@inject NavigationManager NavigationManager
@inject IJSRuntime js
<p>
@Kontrol
<input placeholder="ID" @bind="inputId" />
<br />
<input placeholder="İsim" @bind="inputAd" />
<br />
<input placeholder="Soyisim" @bind="inputSoyad" />
<br />
<input placeholder="Kullanıcı Adı" @bind="inputKullaniciadi" />
<br />
<input type="password" minlenght="8 " placeholder="Şifre" @bind="inputPassword" required />
<br />
<input placeholder="Kullaıcı Rolü" @bind="inputRole" />
</p>
<br />
<button class="btn btn-success" @onclick="GetUser">Kullanıcı Getir</button>
<button class="btn btn-primary" @onclick="InsertUser">Kullacı Ekle</button>
<button class="btn btn-warning" @onclick="UpdateUser">Kullanıcı Güncelle</button>
<button class="btn btn-danger" @onclick="DeleteUser">Kullanıcı Sil</button>
<br />
<br />
<h1>Kullanıcılar</h1>
<br />
<table class="table">
<thead>
<tr>
<th>Kullanıcı ID</th>
<th>Kullanıcı Adı</th>
<th>Kullanıcı Soyadı</th>
<th>Kullanıcı KullancıAdı</th>
<th>Kullanıcı Şifresi</th>
<th>Kullanıcı Rolü</th>
</tr>
</thead>
<tbody>
@if (kullanici == null)
{
<p><em>Loading....</em></p>
}
else
{
@foreach (var xm in kullanici)
{
<tr>
<td>
@xm.Id
</td>
<td>@xm.Ad </td>
<td>@xm.Soyad </td>
<td>@xm.KullaniciAdi</td>
<td>@xm.Password </td>
<td>@xm.Role</td>
</tr>
}
}
</tbody>
</table>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components;
using System.Diagnostics;
using System.Globalization;
using Microsoft.AspNetCore.Components.Server;
using Microsoft.JSInterop;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Net.Http;
using Microsoft.Data.SqlClient;
using System.Data;
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
namespace ex9.Pages.Log
{
public class LogUser
{
public string? Id { get; set; }
public string? Ad { get; set; }
public string? Soyad { get; set; }
public string? KullaniciAdi { get; set; }
public string? Password { get; set; }
public string? Role { get; set; }
}
public class KayıtBase : ComponentBase
{
static string connectionString = ("Server=.;Database=PdfApp;Encrypt=False;Integrated Security=SSPI;");
static SqlConnection conn = new SqlConnection(connectionString);
static string sql = "select Id,Ad,Soyad,KullaniciAdi,Password,Role from Login";
static SqlDataAdapter daps = new SqlDataAdapter(sql, conn);
SqlCommandBuilder cb = new SqlCommandBuilder(daps);
DataSet dsps = new DataSet();
public List<LogUser> kullanici = new List<LogUser>();
public string? error { get; set; }
public string? inputId { get; set; }
public string? inputSoyad { get; set; }
public string? inputRole { get; set; }
public string? inputAd { get; set; }
public string? inputKullaniciadi { get; set; }
public string? inputPassword { get; set; }
private string? kontrol = "";
[Inject]
public ProtectedLocalStorage? localstr { get; set; }
public string? Kontrol
{
get
{
maMen();
return kontrol;
}
set
{
kontrol = value;
}
}
public string? mystr { get; set; }
[Inject]
protected NavigationManager? Navigation { get; set; }
private async void maMen()
{
var result = await localstr.GetAsync<string>("myUser");
mystr = result.Success ? result.Value : "";
if (mystr != "admin")
Navigation.NavigateTo("/");
mystr = "hellozep";
}
public async Task InsertUser()
{
dsps.Tables[0].Rows.Add(null, inputAd, inputSoyad, inputKullaniciadi, inputPassword, inputRole);
daps.Update(dsps, "kullanici");
dsps.Tables["kullanici"].Clear();
//cb.Dispose();
inputAd = "";
inputSoyad = "";
inputKullaniciadi = "";
inputPassword = "";
inputRole = "";
await OnInitializedAsync();
}
public async Task GetUser()
{
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
if (dsps.Tables[0].Rows[i]["Id"].ToString() == inputId)
{
inputAd = dsps.Tables[0].Rows[i]["Ad"].ToString();
inputSoyad = dsps.Tables[0].Rows[i]["Soyad"].ToString();
inputKullaniciadi = dsps.Tables[0].Rows[i]["KullaniciAdi"].ToString();
inputPassword = dsps.Tables[0].Rows[i]["Password"].ToString();
inputRole = dsps.Tables[0].Rows[i]["Role"].ToString();
}
}
dsps.Tables[0].Clear();
await OnInitializedAsync();
}
public async Task UpdateUser()
{
DataRowCollection itemColumns = dsps.Tables[0].Rows;
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
if (dsps.Tables[0].Rows[i]["Id"].ToString() == inputId)
{
dsps.Tables[0].Rows[i]["Ad"] = inputAd;
dsps.Tables[0].Rows[i]["Soyad"] = inputSoyad;
dsps.Tables[0].Rows[i]["KullaniciAdi"] = inputKullaniciadi;
dsps.Tables[0].Rows[i]["Password"] = inputPassword;
dsps.Tables[0].Rows[i]["Role"] = inputRole;
}
}
daps.Update(dsps, "kullanici");
// cb.Dispose();
dsps.Tables[0].Clear();
inputId = "";
inputAd = "";
inputSoyad = "";
inputKullaniciadi = "";
inputPassword = "";
inputRole = "";
await OnInitializedAsync();
}
public async Task DeleteUser()
{
foreach (DataRow row in dsps.Tables[0].Rows)
{
if (row["Id"].ToString() == inputId)
row.Delete();
}
daps.Update(dsps, "kullanici");
// cb.Dispose();
dsps.Tables["kullanici"].Clear();
inputId = "";
inputAd = "";
inputSoyad = "";
inputKullaniciadi = "";
inputPassword = "";
inputRole = "";
await OnInitializedAsync();
}
protected override async Task OnInitializedAsync()
{
kullanici.Clear();
await selectproc();
}
public Task selectproc()
{
return Task.Run(() =>
{
try
{
daps.Fill(dsps, "kullanici");
error += dsps.Tables[0].Rows.Count.ToString();
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
LogUser xm = new LogUser();
xm.Id = dsps.Tables[0].Rows[i]["Id"].ToString();
xm.Ad = dsps.Tables[0].Rows[i]["Ad"].ToString();
xm.Soyad = dsps.Tables[0].Rows[i]["Soyad"].ToString();
xm.KullaniciAdi = dsps.Tables[0].Rows[i]["KullaniciAdi"].ToString();
xm.Password = dsps.Tables[0].Rows[i]["Password"].ToString();
xm.Role = dsps.Tables[0].Rows[i]["Role"].ToString();
kullanici.Add(xm);
}
}
catch (Exception ex)
{
error = ex.ToString();
}
});
}
}
}
\ No newline at end of file
@page "/Giris"
@inherits Pr81Base
@inject IJSRuntime js
@inject NavigationManager NavigationManager
<style>
a:hover{
color:red;
text-decoration: underline overline dotted red;
}
.Tooltip{
position: relative;
border-bottom: 1px dotted black;
cursor: help;
}
#spanText{
visibility:hidden;
position:absolute;
width:300px;
bottom:100%;
left:50%;
margin-left:-150px;
background-color: yellow;
color:black;
text-align:center;
padding: 5px 0;
border-radius: 6px;
z-index:1;
}
#spanText::after{
content:"";
position:absolute;
top:100%;
left:50%;
margin-left:-5px;
border-width:5px;
border-style: solid;
border-color: #555 transparent transparent transparent;
}
.Tooltip:hover #spanText{
visibility: visible;
}
</style>
<h1>Kitaplar</h1>
<br/>
<div class="Tooltip">
<br/><br/><br/>
<table class="table">
<thead>
<tr>
<th>Kitap Numarası</th>
<th>Kitap Adı</th>
<th>Yazar</th>
</tr>
</thead>
<tbody>
@if(people == null )
{
<p><em>Loading....</em></p>
}
else
{
@foreach(var p in people)
{
<tr>
<td>
@p.Id
</td>
<td><a href="@p.Url" >@p.Name </a><span id="spanText">@Text</span></td>
<td>@p.Yazar</td>
</tr>
}
}
</tbody>
</table>
</div>
<br/>
<p>@error Adet Kitab Yüklendi.</p>
@code {
public string Text {get;set;}="Linke Tıklayarak Kitabı İndirebilirsin.";
}
@page "/admin"
@inherits Pr81Base
@inject IJSRuntime js
@Kontrol
<body>
<br/>
<p>
Id:<input @bind="inputId"/>
İsim:<input @bind="inputName"/>
Url:<input @bind="inputUrl"/>
Yazar:<input @bind="inputYazar"/>
</p>
<br/>
<button class="btn btn-success" @onclick="GetData">Pdf Getir</button>
<button class="btn btn-primary" @onclick="InsertData">Insert</button>
<button class="btn btn-warning" @onclick="UpdateData">Update</button>
<button class="btn btn-danger" @onclick="DeleteData">Delete</button>
<div class="Tooltip">
<br/><br/><br/>
<table class="table">
<thead>
<tr>
<th>Kitap Numarası</th>
<th>Kitap Adı</th>
<th>Yazar</th>
</tr>
</thead>
<tbody>
@if(people == null )
{
<p><em>Loading....</em></p>
}
else
{
@foreach(var p in people)
{
<tr>
<td>
@p.Id
</td>
<td><a href="@p.Url" >@p.Name </a></td>
<td>@p.Yazar</td>
</tr>
}
}
</tbody>
</table>
</div>
<br/>
<p>@error Adet Kitab Yüklendi.</p>
</body>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components;
using System.Diagnostics;
using System.Globalization;
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
using Microsoft.JSInterop;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Net.Http;
using Microsoft.Data.SqlClient;
using System.Data;
namespace ex9.Pages.Moderator
{
public class PersonModel
{
public string? Id { get; set; }
public string? Name { get; set; }
public string? Url { get; set; }
public string? Yazar { get; set; }
}
public class Pr81Base : ComponentBase
{
static string connectionString = ("Server=.;Database=PdfApp;Encrypt=False;Integrated Security=SSPI;");
static SqlConnection conn = new SqlConnection(connectionString);
static string sql = "select Id,Name,Url,Yazar from Pdf";
static SqlDataAdapter daps = new SqlDataAdapter(sql, conn);
SqlCommandBuilder cb = new SqlCommandBuilder(daps);
DataSet dsps = new DataSet();
public List<PersonModel> people = new List<PersonModel>();
public string? error { get; set; }
public string? inputId { get; set; }
public string? inputName { get; set; }
public string? inputUrl { get; set; }
public string? inputYazar { get; set; }
private string? kontrol = "";
[Inject]
public ProtectedLocalStorage? localstr { get; set; }
public string? Kontrol
{
get
{
AdminModerator();
return kontrol;
}
set
{
kontrol = value;
}
}
public string? mystr { get; set; }
[Inject]
protected NavigationManager? Navigation { get; set; }
private async void AdminModerator()
{
var result = await localstr.GetAsync<string>("myUser");
mystr = result.Success ? result.Value : "";
if (mystr != "admin")
if (mystr != "moderator")
Navigation.NavigateTo("/");
mystr = "";
}
public async Task InsertData()
{
dsps.Tables[0].Rows.Add(null, inputName, inputUrl, inputYazar);
daps.Update(dsps, "people");
dsps.Tables["people"].Clear();
//cb.Dispose();
inputName = "";
inputUrl = "";
inputYazar = "";
await OnInitializedAsync();
}
public async Task GetData()
{
DataRowCollection itemColumns = dsps.Tables[0].Rows;
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
if (dsps.Tables[0].Rows[i]["Id"].ToString() == inputId)
{
inputName = dsps.Tables[0].Rows[i]["Name"].ToString();
inputUrl = dsps.Tables[0].Rows[i]["Url"].ToString();
inputYazar = dsps.Tables[0].Rows[i]["Yazar"].ToString();
}
}
dsps.Tables[0].Clear();
await OnInitializedAsync();
}
public async Task UpdateData()
{
DataRowCollection itemColumns = dsps.Tables[0].Rows;
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
if (dsps.Tables[0].Rows[i]["Id"].ToString() == inputId)
{
dsps.Tables[0].Rows[i]["Name"] = inputName;
dsps.Tables[0].Rows[i]["Url"] = inputUrl;
dsps.Tables[0].Rows[i]["Yazar"] = inputYazar;
}
}
daps.Update(dsps, "people");
// cb.Dispose();
dsps.Tables[0].Clear();
inputId = "";
inputName = "";
inputUrl = "";
inputYazar = "";
await OnInitializedAsync();
}
public async Task DeleteData()
{
foreach (DataRow row in dsps.Tables[0].Rows)
{
if (row["Id"].ToString() == inputId)
row.Delete();
}
daps.Update(dsps, "people");
// cb.Dispose();
dsps.Tables["people"].Clear();
inputId = "";
inputName = "";
await OnInitializedAsync();
}
protected override async Task OnInitializedAsync()
{
people.Clear();
await selectproc();
}
public Task selectproc()
{
return Task.Run(() =>
{
try
{
daps.Fill(dsps, "people");
error += dsps.Tables[0].Rows.Count.ToString();
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
PersonModel pm = new PersonModel();
pm.Id = dsps.Tables[0].Rows[i]["Id"].ToString();
pm.Name = dsps.Tables[0].Rows[i]["Name"].ToString();
pm.Url = dsps.Tables[0].Rows[i]["Url"].ToString();
pm.Yazar = dsps.Tables[0].Rows[i]["Yazar"].ToString();
people.Add(pm);
}
}
catch (Exception ex)
{
error = ex.ToString();
}
});
}
}
}
\ No newline at end of file
@page "/"
@namespace ex9.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@{
Layout = "_Layout";
}
<component type="typeof(App)" render-mode="ServerPrerendered" />
<script src="~/js/getSelectedBook.js"></script>
\ No newline at end of file
@using Microsoft.AspNetCore.Components.Web
@namespace ex9.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="~/" />
<link rel="stylesheet" href="css/bootstrap/bootstrap.min.css" />
<link href="css/site.css" rel="stylesheet" />
<link href="ex9.styles.css" rel="stylesheet" />
<component type="typeof(HeadOutlet)" render-mode="ServerPrerendered" />
</head>
<body>
@RenderBody()
<div id="blazor-error-ui">
<environment include="Staging,Production">
An error has occurred. This application may no longer respond until reloaded.
</environment>
<environment include="Development">
An unhandled exception has occurred. See browser dev tools for details.
</environment>
<a href="" class="reload">Reload</a>
<a class="dismiss">🗙</a>
</div>
<script src="_framework/blazor.server.js"></script>
</body>
</html>
@page "/Sıgn"
@inherits SıgnBase
<style>
* {
margin: 0;
padding: 0;
text-decoration: none;
font-family: sans-serif;
box-sizing: border-box;
}
body {
width: 100%;
height: 100%;
}
.kutu {
width: 400px;
background: white;
height: 700px;
padding: 80px 40px;
/*sağdan soldan 40px yukarıdan aşağıdan 80 px padding*/
border-radius: 10px;
border-style: solid ;
/*köşleri ovalleştirme*/
position: absolute;
left: 58%;
/*soldan hizalama*/
top: 50%;
/*yukarıdan hizalama*/
transform: translate(-50%, -50%);
/*tam hizalama sağlamak için*/
}
.txtb {
/*alt çizgi ekleme*/
position: relative;
margin: 30px 0;
}
.txtb input {
font-size: 15px;
color: #333;
border: none;
width: 100%;
outline: none;
background: none;
padding: 0 5px;
height: 40px;
border-bottom: 2px solid #adadad;
}
img.adminimg {
margin-left: 85px;
margin-bottom: 50px;
display: block;
background: black;
border-radius: 25%;
width: 140px;
height: 140px;
}
.logbtn {
display: block;
width: 100%;
height: 50px;
border: none;
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, black 70%);
background-size: 200%;
color: white;
outline: none;
/*köşelerini kapatmak siyah olmamsı için*/
cursor: pointer;
border-radius: 15px;
}
.logbtn:hover {
background: white;
color: black;
border: 2px solid black;
}
</style>
<body>
<div class="kutu">
<div class="contact-form">
<img src="images/kullanici.jpg" class="adminimg">
<h2>Kayıt Ol</h2>
<form action="">
<div class="txtb">
<input type="text" placeholder="İsim" @bind="inputAd" required />
<input type="text" placeholder="Soyisim " @bind="inputSoyad" required />
<input type="text" placeholder="Kullanıcı Adı" @bind="inputKullaniciAdi" maxlength="32"
minlength="8" required />
<input type="password" placeholder="Şifre" @bind="inputPassword" maxlength="32" minlength="8"
required />
</div>
<input type="button" class="logbtn" value="Kayıt Ol" @onclick="InsertAccount" />
<br><input type="button" class="logbtn" value="Giriş Yap" onclick="window.location.href ='/';" />
</form>
</div>
</div>
</body>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components;
using System.Diagnostics;
using System.Globalization;
using Microsoft.AspNetCore.Components.Server.ProtectedBrowserStorage;
using Microsoft.JSInterop;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Net.Http;
using Microsoft.Data.SqlClient;
using System.Data;
namespace ex9.Pages.kayit
{
public class Sıgnbase
{
public string? Id { get; set; }
public string? Ad { get; set; }
public string? Soyad { get; set; }
public string? KullaniciAdi { get; set; }
public string? Password { get; set; }
}
public class SıgnBase : ComponentBase
{
static string connectionString = ("Server=.;Database=PdfApp;Encrypt=False;Integrated Security=SSPI;");
static SqlConnection conn = new SqlConnection(connectionString);
static string sql = "select Id,Ad,Soyad,KullaniciAdi,Password,Role from Login";
static SqlDataAdapter daps = new SqlDataAdapter(sql, conn);
SqlCommandBuilder cb = new SqlCommandBuilder(daps);
DataSet dsps = new DataSet();
public List<Sıgnbase> people = new List<Sıgnbase>();
public string? error { get; set; }
public string? inputSoyad { get; set; }
public string? inputAd { get; set; }
public string? inputKullaniciAdi { get; set; }
public string? inputPassword { get; set; }
public async Task InsertAccount()
{
if (inputAd != null && inputSoyad != null && inputKullaniciAdi != null && inputPassword != null)
{
dsps.Tables[0].Rows.Add(null, inputAd, inputSoyad, inputKullaniciAdi, inputPassword, "user");
daps.Update(dsps, "people");
dsps.Tables["people"].Clear();
//cb.Dispose();
inputAd = "";
inputSoyad = "";
inputKullaniciAdi = "";
inputPassword = "";
}
else
{
}
await OnInitializedAsync();
}
protected override async Task OnInitializedAsync()
{
people.Clear();
await selectproc();
}
public Task selectproc()
{
return Task.Run(() =>
{
try
{
daps.Fill(dsps, "people");
error += dsps.Tables[0].Rows.Count.ToString();
for (int i = 0; i < dsps.Tables[0].Rows.Count; i++)
{
Sıgnbase pm = new Sıgnbase();
pm.Id = dsps.Tables[0].Rows[i]["Id"].ToString();
pm.Ad = dsps.Tables[0].Rows[i]["Ad"].ToString();
pm.Soyad = dsps.Tables[0].Rows[i]["Soyad"].ToString();
pm.KullaniciAdi = dsps.Tables[0].Rows[i]["KullaniciAdi"].ToString();
pm.Password = dsps.Tables[0].Rows[i]["Password"].ToString();
people.Add(pm);
}
}
catch (Exception ex)
{
error = ex.ToString();
}
});
}
}
}
\ No newline at end of file
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web;
using ex9.Data;
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<WeatherForecastService>();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
app.MapBlazorHub();
app.MapFallbackToPage("/_Host");
app.Run();
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:40972",
"sslPort": 44397
}
},
"profiles": {
"ex9": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:7037;http://localhost:5183",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}
@inherits LayoutComponentBase
<PageTitle>ex9</PageTitle>
<div class="page">
<div class="sidebar">
<NavMenu />
</div>
<main>
<article class="content px-4">
@Body
</article>
</main>
</div>
.page {
position: relative;
display: flex;
flex-direction: column;
}
main {
flex: 1;
}
.sidebar {
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, black 70%);
}
.top-row {
background-color: none;
justify-content: flex-end;
height: 3.5rem;
display: flex;
align-items: center;
}
.top-row ::deep a,
.top-row .btn-link {
white-space: nowrap;
margin-left: 1.5rem;
}
.top-row a:first-child {
overflow: hidden;
text-overflow: ellipsis;
}
@media (max-width: 640.98px) {
.top-row:not(.auth) {
display: none;
}
.top-row.auth {
justify-content: space-between;
}
.top-row a,
.top-row .btn-link {
margin-left: 0;
}
}
@media (min-width: 641px) {
.page {
flex-direction: row;
}
.sidebar {
width: 250px;
height: 100vh;
position: sticky;
top: 0;
}
.top-row {
position: sticky;
top: 0;
z-index: 1;
}
.top-row,
article {
padding-left: 2rem !important;
padding-right: 1.5rem !important;
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment