public async Task <IActionResult> Edit(int id, [Bind("Id,TahlilAd,TahlilSonucu,HastaGecmisiId")] Tahliller tahliller) { if (id != tahliller.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(tahliller); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TahlillerExists(tahliller.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["HastaGecmisiId"] = new SelectList(_context.HastaGecmisi, "Id", "GecirdigiAmeliyatlar", tahliller.HastaGecmisiId); return(View(tahliller)); }
private void btnTahlilEkle_Click(object sender, EventArgs e) { lbIstenilenTahliller.Items.Add(cbIstenilenTahliller.SelectedItem); Tahliller th = new Tahliller(); th.KabulID = Convert.ToInt32(lblKabulID.Text); th.Aciklama = cbIstenilenTahliller.SelectedItem.ToString(); th.TahlilEkle(th); }
public async Task <IActionResult> Create([Bind("Id,TahlilAd,TahlilSonucu,HastaGecmisiId")] Tahliller tahliller) { if (ModelState.IsValid) { _context.Add(tahliller); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["HastaGecmisiId"] = new SelectList(_context.HastaGecmisi, "Id", "GecirdigiAmeliyatlar", tahliller.HastaGecmisiId); return(View(tahliller)); }
public MessageResult Create(Tahliller model) { var _validator = new TahlilAddValidator(); ValidationResult result = _validator.Validate(model); if (result.IsValid) { _tahlilRepository.Add(model); } var m = new MessageResult { ErrorMessage = result.Errors.Select(x => x.ErrorMessage).ToList(), IsSucceed = result.IsValid }; m.SuccessMessage = m.IsSucceed == true ? "Tahlil Ekleme İşlemi Başarılı." : "Hatalı bilgiler mevcut"; return m; }
private void btnTahlilOlustur_Click(object sender, EventArgs e) { var model = new Tahliller { TahlilAdi = txtTahlilAdi.Text, TahlilUcreti = Convert.ToDecimal(txtTahlilUcreti.Text) }; var result = _tahlilService.Create(model); if (result.IsSucceed) { MessageBox.Show(result.SuccessMessage, @"İşlem Gerçekleştirildi!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(string.Join("\n", result.ErrorMessage), @"İşlem Gerçekleştirilemedi!", MessageBoxButtons.OK, MessageBoxIcon.Error); } TahlilDoldur(); }