public int SimpanMahasiswa(MahasiswaModel model) { int hasil = -1; try { string Query = @"Insert into TbMahasiswa ([NPM] ,[Nama] ,[JK] ,[IdJurusan] ,[Alamat] ,[TglLahir] ,[Email]) Values('" + model.NPM + "'," + "'" + model.Nama + "'," + "'" + model.JK + "'," + "'" + model.IdJurusan + "'," + "'" + model.Alamat + "'," + "'" + model.TglLahir + "'," + "'" + model.Email + "')"; hasil = SQLHelpers.ExecQuery(Query); return(hasil); } catch (Exception ex) { throw ex; } }
public int DeleteJurusan(string Id) { int hasil = -1; try { string Query = @"Delete TbJurusan Where IdJurusan = '" + Id + "'"; hasil = SQLHelpers.ExecQuery(Query); return(hasil); } catch (Exception ex) { throw ex; } }
public int DeleteMahasiswa(string NPM) { int hasil = -1; try { string Query = @"Delete TbMahasiswa Where IdMahasiswa = '" + NPM + "'"; hasil = SQLHelpers.ExecQuery(Query); return(hasil); } catch (Exception ex) { throw ex; } }
public int SimpanJurusan(JurusanModel model) { int hasil = -1; try { string Query = @"Insert into TbJurusan values('" + model.idJurusan + "','" + model.jurusan + "')"; hasil = SQLHelpers.ExecQuery(Query); return(hasil); } catch (Exception ex) { throw ex; } }
public int DeleteJurusan(string id) { int hasil = -1; try { string Query = @"DELETE TbJurusan WHERE IdJurusan= '" + id + "' "; hasil = SQLHelpers.ExecQuery(Query); return(hasil); } catch (Exception ex) { throw ex; } }
public int UpdateJurusan(JurusanModel model) { int hasil = -1; try { string Query = @"UPDATE TbJurusan SET Jurusan = '" + model.jurusan + "' WHERE IdJurusan ='" + model.idJurusan + "' "; hasil = SQLHelpers.ExecQuery(Query); return(hasil); } catch (Exception ex) { throw ex; } }
public int UpdateMahasiswa(MahasiswaModel model) { int hasil = -1; try { string Query = @"Update TbMahasiswa SET Nama = '" + model.Nama + "', " + "JK = '" + model.JK + "', " + "IdJurusan = '" + model.IdJurusan + "', " + "Alamat = '" + model.Alamat + "', " + "TglLahir = '" + model.TglLahir + "', " + "Email = '" + model.Email + "' " + "Where NPM = '" + model.NPM + "'"; hasil = SQLHelpers.ExecQuery(Query); return(hasil); } catch (Exception ex) { throw ex; } }