public IActionResult Sil(Eczaci item) { try { using (var dbConnection = DatabaseBaglanti.Connection()) { dbConnection.Open(); dbConnection.Execute("delete from public.eczaci where Id = @Id ", item); } return(Json(new { basarili = true })); } catch (System.Exception) { return(Json(new { basarisiz = true })); } }
private void btnEczaciGiris_Click(object sender, EventArgs e) { LoginModel user = new LoginModel(); user.KullaniciAdi = txtKullaniciAdi.Text; user.Sifre = txtSifre.Text; Eczaci girisYapan = eczaciBLL.Login(user); if (girisYapan != null) { frmEczaciIslemEkrani frm = new frmEczaciIslemEkrani(); this.Hide(); frm.ShowDialog(); } else { MessageBox.Show("Eczacı Giriş bilgileri hatalı!"); } }
public IActionResult Kontrol(Eczaci item) { try { using (var dbConnection = DatabaseBaglanti.Connection()) { dbConnection.Open(); item = dbConnection.QueryFirst <Eczaci>("select * from public.eczaci where tc = @tc and sifre = @sifre", item); HttpContext.Session.SetInt32("Id", item.Id); HttpContext.Session.SetString("Adi", item.Adi); } return(RedirectToAction("Index", "Home")); } catch (System.Exception ex) { HttpContext.Session.SetString("LoginError", "true"); return(RedirectToAction("Index")); } }
public List <Eczaci> TumEczacilariGetir() { List <Eczaci> eczacilar = new List <Eczaci>(); SqlCommand cmd = new SqlCommand("sp_EczacilariGetir", DBConnection.Conn); cmd.CommandType = CommandType.StoredProcedure; try { if (DBConnection.Conn.State != System.Data.ConnectionState.Open) { DBConnection.Conn.Open(); } rdr = cmd.ExecuteReader(); if (rdr.HasRows) { Eczaci eczaci; while (rdr.Read()) { eczaci = new Eczaci() { ID = Convert.ToInt32(rdr["ID"]), KullaniciAdi = rdr["KullaniciAdi"].ToString(), Sifre = rdr["Sifre"].ToString() }; eczacilar.Add(eczaci); } } return(eczacilar); } catch (Exception) { return(null); } finally { rdr.Close(); DBConnection.Conn.Close(); } }
public IActionResult Kaydet(Eczaci item) { try { using (var dbConnection = DatabaseBaglanti.Connection()) { dbConnection.Open(); if (item.Id == 0) { dbConnection.Execute("insert into public.eczaci (adi,soyadi, telefon,sifre,tc,eczaneid) values(@adi,@soyadi, @telefon, @sifre ,@tc,@eczaneid)", item); } else { dbConnection.Execute("update public.eczaci set adi = @adi, soyadi=@soyadi,sifre=@sifre, telefon=@telefon,tc=@tc,eczaneid=@eczaneid where Id = @Id", item); } } return(Json(new { basarili = true })); } catch (System.Exception ex) { return(Json(new { basarisiz = true })); } }