Ошибка с сохранением данных в БД С#
Привет не получается сохранить данные в БД. Использую SQLIte. Не может преобразовать из AppStaff в Staff
public partial class Staff : Window
{
AppContecst db;
public Staff()
{
InitializeComponent();
db = new AppContecst(); //обращение к класу подключения базы данных выделение памяти
}
private void Button_add_Click(object sender, RoutedEventArgs e)
{
string name = textboxName.Text.Trim();
string famil = textboxfamil.Text.Trim();
string otches = textboxotches.Text.Trim();
string pol = textboxpol.Text.Trim();
string podrazdel = textboxpodrazdel.Text.Trim();
string dolzhnost = textboxdolzhnost.Text.Trim();
string kabinet = textboxkabinet.Text.ToLower().Trim();
string telefon_rab = textboxtelefon_rab.Text.Trim();
string telefon_lichni = textboxtelefon_lichni.Text.Trim();
string pochta = textboxpochta.Text.ToLower().Trim();
string date_rozhde = textboxdate_rozhde.Text.Trim();
string mesto_rozh = textboxmesto_rozh.Text.Trim();
string grazhdan = textboxgrazhdan.Text.ToLower().Trim();
string semeinoe = textboxsemeinoe.Text.Trim();
MessageBox.Show("gut"); //окно с сообщением что регистрация прошла успешна
AppStaff Staffs = new AppStaff(name, famil, otches, pol, podrazdel, dolzhnost, kabinet, telefon_rab, telefon_lichni, pochta, date_rozhde, mesto_rozh, grazhdan, semeinoe);
db.Staffs.Add(Staffs);
db.SaveChanges(); //Сохранение в базе данных
AuthWindow authWindow = new AuthWindow();
authWindow.Show();
Hide();//Прятать текущее окно
}
}
}
Вот класс из которого не может преобразовать
class AppStaff
{
public int id { get; set; }
private string name, famil, otches, pol, podrazdel, dolzhnost, kabinet, telefon_rab, telefon_lichni, pochta, date_rozhde, mesto_rozh, grazhdan, semeinoe;
public string Name
{
get { return name; }
set { name = value; }
}
public string Famil
{
get { return famil; }
set { famil = value; }
}
public string Otches
{
get { return otches; }
set { otches = value; }
}
public string Pol
{
get { return pol; }
set { pol = value; }
}
public string Podrazdel
{
get { return podrazdel; }
set { podrazdel = value; }
}
public string Dolzhnost
{
get { return dolzhnost; }
set { dolzhnost = value; }
}
public string Kabinet
{
get { return kabinet; }
set { kabinet = value; }
}
public string Telefon_rab
{
get { return telefon_rab; }
set { telefon_rab = value; }
}
public string Telefon_lichni
{
get { return telefon_lichni; }
set { telefon_lichni = value; }
}
public string Pochta
{
get { return pochta; }
set { pochta = value; }
}
public string Date_rozhde
{
get { return date_rozhde; }
set { date_rozhde = value; }
}
public string Mesto_rozh
{
get { return mesto_rozh; }
set { mesto_rozh = value; }
}
public string Grazhdan
{
get { return grazhdan; }
set { grazhdan = value; }
}
public string Semeinoe
{
get { return semeinoe; }
set { semeinoe = value; }
}
public AppStaff() { }
public AppStaff(string name, string famil, string otches , string pol, string podrazdel, string dolzhnost, string kabinet, string telefon_rab,
string telefon_lichni, string pochta, string date_rozhde, string mesto_rozh, string grazhdan, string semeinoe)
{
this.name = name;
this.famil = famil;
this.otches = otches;
this.pol = pol;
this.podrazdel = podrazdel;
this.dolzhnost = dolzhnost;
this.kabinet = kabinet;
this.telefon_rab = telefon_rab;
this.telefon_lichni = telefon_lichni;
this.pochta = pochta;
this.date_rozhde = date_rozhde;
this.mesto_rozh = mesto_rozh;
this.grazhdan = grazhdan;
this.semeinoe = semeinoe;
}
}
}