Create FormLogin
This commit is contained in:
46
DB/MainDB.cs
Normal file
46
DB/MainDB.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Diplom_B.DB
|
||||
{
|
||||
public class MainDB : DbContext
|
||||
{
|
||||
public DbSet<Zakazchik> Zakazchiki { get; set; }
|
||||
public DbSet<User> Users { get; set; }
|
||||
|
||||
public MainDB() { Database.EnsureCreated(); }
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
optionsBuilder.UseSqlite("Data Source=" + Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "Diplom_B.db;");
|
||||
}
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder) { }
|
||||
|
||||
}
|
||||
|
||||
public class User
|
||||
{
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Pass { get; set; }
|
||||
}
|
||||
|
||||
public class Zakazchik
|
||||
{
|
||||
[Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Adres { get; set; }
|
||||
public string Phone { get; set; }
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user