public JenisArsipModel GetData(IJenisArsipKey key) { JenisArsipModel result = null; var sql = @" SELECT JenisArsipName FROM OFTA_JenisArsip WHERE JenisArsipID = @JenisArsipID"; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@JenisArsipID", key.JenisArsipID, SqlDbType.VarChar); conn.Open(); using (var dr = cmd.ExecuteReader()) { if (!dr.HasRows) { return(null); } dr.Read(); result = new JenisArsipModel { JenisArsipID = key.JenisArsipID, JenisArsipName = dr["JenisArsipName"].ToString() }; } } return(result); }
public void Delete(IJenisArsipKey key) { // INPUT VALIDATION if (key is null) { throw new ArgumentException("JENIS ARSIP ID empty"); } // REPO-OP _jenisArsipDal.Delete(key); }
public JenisArsipModel GetData(IJenisArsipKey key) { // INPUT VALIDATION if (key is null) { throw new ArgumentException("JENIS ARSIP ID empty"); } // REPO-OP var result = _jenisArsipDal.GetData(key); // RETURN return(result); }
public void Delete(IJenisArsipKey key) { var sql = @" DELETE OFTA_JenisArsip WHERE JenisArsipID = @JenisArsipID"; using (var conn = new SqlConnection(ConnStringHelper.Get())) using (var cmd = new SqlCommand(sql, conn)) { cmd.AddParam("@JenisArsipID", key.JenisArsipID, SqlDbType.VarChar); conn.Open(); cmd.ExecuteNonQuery(); } }