private void materialFlatButton1_Click(object sender, EventArgs e) { ConcertContext cc = new ConcertContext(); var concert = cc.Concerts.Find(multi_c * 3 + 2); VisitorContext vc = new VisitorContext(); var visitor = vc.Visitors.Find(user_id); concert.Visitors.Add(visitor); visitor.Concerts.Add(concert); vc.SaveChanges(); cc.SaveChanges(); }
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(); }
private void materialFlatButton3_Click(object sender, EventArgs e) { materialLabel2.Text = multi_c.ToString(); ConcertContext cc = new ConcertContext(); var concert = cc.Concerts.Find(multi_c * 3 + 1); var g = concert.Name; VisitorContext vc = new VisitorContext(); var visitor = vc.Visitors.Find(user_id); visitor.BuyTicket(ref concert); var f = visitor.Login; //Visitor vs = new Visitor(); //vs.cardNumber = visitor.cardNumber; //vs.CurrentSum = visitor.CurrentSum; //vs.Id = visitor.Id; //vs.Login = visitor.Login; //vs.Password = visitor.Password; //vs.phoneNumber = visitor.phoneNumber; //vs.profileImage = visitor.profileImage; //vs.rank = visitor.rank; //vs.Concerts = visitor.Concerts; //Concert cnc = new Concert(); //cnc.Date = concert.Date; //cnc.Id = concert.Id; //cnc.Manager = concert.Manager; //cnc.Name = concert.Name; //cnc.Place = concert.Place; //cnc.Singers = concert.Singers; //cnc.TicketPrice = concert.TicketPrice; //cnc.Tickets = concert.Tickets; //cnc.Visitors = concert.Visitors; //cnc.WallPaper = concert.WallPaper; cc.Entry(concert).State = EntityState.Modified; vc.Entry(visitor).State = EntityState.Modified; //visitor.Concerts.Add(concert); concert.Visitors.Add(visitor); vc.SaveChanges(); cc.SaveChanges(); }
private void button1_Click(object sender, EventArgs e) { ConcertContext db = new ConcertContext(); SingerContext dw = new SingerContext(); Concert concert = new Concert(); var FN = openFileDialog1.FileName.Split('\\'); var fileOfPic = "ConcertWallpapers\\" + FN.Last(); pictureBox2.Image.Save(fileOfPic); concert.Place = materialSingleLineTextField1.Text; concert.Tickets = Convert.ToInt32(materialSingleLineTextField2.Text); concert.TicketPrice = Convert.ToInt32(materialSingleLineTextField3.Text); concert.Name = materialSingleLineTextField4.Text; concert.WallPaper = fileOfPic; concert.Singers = dw.Singers.FirstOrDefault(p => p.Login == comboBox1.Text); concert.Date = dateTimePicker1.Text; ManagerContext mc = new ManagerContext(); concert.Manager = mc.Managers.Find(man_id); //concert.SingerName = comboBox1.Text; db.Concerts.Add(concert); db.SaveChanges(); }