This commit is contained in:
2025-08-08 12:31:51 +03:00
parent 3301e17f22
commit 4796beac49
29 changed files with 2369 additions and 77 deletions

23
Models/Il.cs Normal file
View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DugunSalonu.Models
{
public class Il
{
public Il()
{
salons = new HashSet<Salon>();
}
[Key]
public int Id { get; set; }
public string Adi { get; set; }
ICollection<Salon>? salons { get; set; }
}
}

37
Models/Kullanici.cs Normal file
View File

@@ -0,0 +1,37 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DugunSalonu.Models
{
internal class Kullanici
{
[Key]
public int Id { get; set; }
[MaxLength(50), MinLength(5)]
[Required]
public required string KullaniciAdi { get; set; }
[Required]
[MaxLength(50)]
public required string Adi { get; set; }
[Required]
[MaxLength(50)]
public required string Soyadi { get; set; }
public string AdiSoyadi { get { return $"{Adi} {Soyadi}"; } }
[Required]
public required string Parola { get; set; }
[MaxLength(50)]
public string? Eposta { get; set; }
[MaxLength(10), MinLength(10)]
public string? CepTel { get; set; }
public bool Aktif { get; set; }
public bool Admin { get; set; }
}
}

29
Models/Salon.cs Normal file
View File

@@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DugunSalonu.Models
{
public class Salon
{
[Key]
public int Id { get; set; }
public string Adi { get; set; }
public string Adres { get; set; }
public int IlId { get; set; }
public int Ilce { get; set; }
public string Eposta { get; set; }
public string VergiDairesi { get; set; }
public string VergiNumarasi { get; set; }
public string Telefon { get; set; }
[MaxLength(10), MinLength(10)]
public string CepTel { get; set; }
public string WebAdres { get; set; }
public Il? il { get; set; }
}
}

View File

@@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DugunSalonu.Models
{
internal class dugunsalonuContext:DbContext
{
public DbSet<Kullanici> kullanici { get; set; }
public DbSet<Salon> salon { get; set; }
public DbSet<Il> il { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql("Server=edoysoft.com;Database=DugunSalonu;User Id=postgres;Password=MgC1453MgC;", b => b.EnableRetryOnFailure());
base.OnConfiguring(optionsBuilder);
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
// Sütun isimlerini büyük harfe dönüştür
foreach (var property in entityType.GetProperties())
{
var columnName = property.GetColumnName(StoreObjectIdentifier.Table(entityType.GetTableName(), entityType.GetSchema()));
// property.SetColumnName(Encoding.ASCII.GetString(columnName.ToLower()));
}
// İsteğe bağlı: Tablo isimlerini de büyük harfe dönüştür (eğer istiyorsanız)
entityType.SetTableName(entityType.GetTableName().ToLower());
}
}
}
}