public ActionResult FotoDuzenleEklePost(HttpPostedFileBase uploadFile) { if (CurrentSession.currentUser != null) { if (uploadFile == null) { return(RedirectToAction("FotoDuzenleAdmin", "Admin", new { ilanId = CurrentSession.currentIlanId })); } SoruCevap foto = new SoruCevap(); string filepath = Path.Combine(Server.MapPath("~/images/"), Path.GetFileName(uploadFile.FileName)); uploadFile.SaveAs(filepath); foto.Message = uploadFile.FileName; foto.CreatedOn = DateTime.Now; foto.Type = "foto"; context.SoruCevaplar.Add(foto); context.SaveChanges(); return(RedirectToAction("FotoDuzenleAdmin", "Admin", new { message = "FOTOĞRAF EKLEME BAŞARILI !" })); } else { return(HttpNotFound()); } }
private void button3_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(rtbSoru.Text)) { MessageBox.Show("Lütfen soru kısmını doldurunuz!", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (string.IsNullOrWhiteSpace(tbA.Text) || string.IsNullOrWhiteSpace(tbB.Text) || string.IsNullOrWhiteSpace(tbC.Text) || string.IsNullOrWhiteSpace(tbD.Text)) { MessageBox.Show("Lütfen tüm cevapları doldurunuz!", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } if (radioButton1.Checked == false && radioButton2.Checked == false && radioButton3.Checked == false && radioButton4.Checked == false) { MessageBox.Show("Lütfen doğru cevabı seçiniz!", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } string dogruCevap = ""; if (radioButton1.Checked == true) { dogruCevap = "A"; } if (radioButton2.Checked == true) { dogruCevap = "B"; } if (radioButton3.Checked == true) { dogruCevap = "C"; } if (radioButton4.Checked == true) { dogruCevap = "D"; } SoruCevap soru = new SoruCevap() { Soru = rtbSoru.Text, Cevap1 = tbA.Text, Cevap2 = tbB.Text, Cevap3 = tbC.Text, Cevap4 = tbD.Text, DogruSecenek = dogruCevap }; service.Add(soru); MessageBox.Show("Soru giriş işlemi tamamlandı.", "Başarılı", MessageBoxButtons.OK, MessageBoxIcon.Information); FillGrid(); }
public ActionResult FotoDuzenleSilPost(int fotoId) { SoruCevap foto = new SoruCevap(); foto = context.SoruCevaplar.Where(x => x.Id == fotoId).FirstOrDefault(); context.SoruCevaplar.Remove(foto); context.SaveChanges(); return(RedirectToAction("FotoDuzenleAdmin", "Admin")); }
public ActionResult SoruCevaplarAdmin(string message, string baginti) { SoruCevap cevap = new SoruCevap(); cevap.Baginti = baginti; cevap.Message = message; cevap.CreatedOn = DateTime.Now; cevap.Type = "cevap"; context.SoruCevaplar.Add(cevap); context.SaveChanges(); return(RedirectToAction("SoruCevaplarAdmin", "Admin")); }
public ActionResult SoruCevap(string name, string message, string email) { SoruCevap sorucvp = new SoruCevap(); sorucvp.Name = name; sorucvp.Email = email; sorucvp.CreatedOn = DateTime.Now; sorucvp.Message = message; sorucvp.Type = "soru"; context.SoruCevaplar.Add(sorucvp); context.SaveChanges(); return(RedirectToAction("SoruCevap", "Home", new { situation = "mesaj" })); }
private void button1_Click(object sender, EventArgs e) { string cevap = ""; if (rbA.Checked == true) { cevap = "A"; } if (rbB.Checked == true) { cevap = "B"; } if (rbC.Checked == true) { cevap = "C"; } if (rbD.Checked == true) { cevap = "D"; } if (lastcheckeditem == 0 && cevap == soruBilgileri.DogruSecenek) { MessageBox.Show("Tam 1.000.000 TL kazandınız. Tebrikler!", "Kazandınız!", MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Restart(); } if (cevap == soruBilgileri.DogruSecenek) { MessageBox.Show("Soruyu doğru bildiniz, yarışmaya devam edebilirsin.", "Doğru Cevap", MessageBoxButtons.OK, MessageBoxIcon.Information); lastcheckeditem--; clbPara.SetItemChecked(lastcheckeditem, true); soruBilgileri = service.SoruAl(); Doldur(); } else { MessageBox.Show("Soruyu yanlış bildiniz. Oyun sona erdi! Sadece " + clbPara.Items[lastcheckeditem].ToString().Split(':')[1].Trim() + " kazandınız.", "Kaybettin", MessageBoxButtons.OK, MessageBoxIcon.Warning); Application.Restart(); } }
private void Form2_Load(object sender, EventArgs e) { clbPara.Items.Add("12 : 1.000.000 TL"); clbPara.Items.Add("11 : 250.000 TL"); clbPara.Items.Add("10 : 125.000 TL"); clbPara.Items.Add("9 : 60.000 TL"); clbPara.Items.Add("8 : 30.000 TL"); clbPara.Items.Add("7 : 15.000 TL"); clbPara.Items.Add("6 : 7.500 TL"); clbPara.Items.Add("5 : 5.000 TL"); clbPara.Items.Add("4 : 3.000 TL"); clbPara.Items.Add("3 : 2.000 TL"); clbPara.Items.Add("2 : 1.000 TL"); clbPara.Items.Add("1 : 500 TL"); clbPara.SetItemChecked(11, true); service.SoruAyarla(); soruBilgileri = service.SoruAl(); lastcheckeditem = 11; Doldur(); }