public void MakeConcert(Singer s, string date, string place = "Arena") { Concert concert = new Concert(); concert.Singers = s; concert.Date = date; InformSinger(s, ref concert); ConcertContext db = new ConcertContext(); db.Concerts.Add(concert); db.SaveChanges(); }
public void InformSinger(Singer s, ref Concert c) { s.NextConcert = c.Date; }
private void button1_Click_1(object sender, EventArgs e) { var login = textBox1.Text; var password = maskedTextBox1.Text; var cpassword = maskedTextBox2.Text; var phone_number = maskedTextBox3.Text; var card_number = maskedTextBox4.Text; var rank = 1; if (materialRadioButton2.Checked) { rank = 2; } else if (materialRadioButton3.Checked) { rank = 3; } var FN = openFileDialog1.FileName.Split('\\'); var fileOfPic = "ProfileImages\\" + FN.Last(); pictureBox1.Image.Save(fileOfPic); //"\\ProfileImages\\" + if (rank == 1) { VisitorContext vc = new VisitorContext(); Visitor visitor = new Visitor(); if (password == cpassword) { visitor.Login = login; visitor.Password = password; visitor.phoneNumber = phone_number; visitor.cardNumber = card_number; visitor.rank = rank; visitor.profileImage = fileOfPic; vc.Visitors.Add(visitor); vc.SaveChanges(); } } else if (rank == 2) { SingerContext sc = new SingerContext(); Singer singer = new Singer(); if (password == cpassword) { singer.Login = login; singer.Password = password; singer.phoneNumber = phone_number; singer.cardNumber = card_number; singer.rank = rank; singer.profileImage = fileOfPic; sc.Singers.Add(singer); sc.SaveChanges(); } } else { ManagerContext mc = new ManagerContext(); Manager manager = new Manager(); if (password == cpassword) { manager.Login = login; manager.Password = password; manager.phoneNumber = phone_number; manager.cardNumber = card_number; manager.rank = rank; manager.profileImage = fileOfPic; manager.Concerts = null; mc.Managers.Add(manager); mc.SaveChanges(); } } }