public int Update(lkup_splmtl_diag_cat entity)
{
try
{
using ( var ctx = new ClinicDataContext(connString) )
{
var supplementalDiagnosisCategories = ctx.lkup_splmtl_diag_cat.FirstOrDefault(x => x.splmtl_diag_cat_id == entity.splmtl_diag_cat_id);
if ( supplementalDiagnosisCategories == null )
{
throw new Exception("Record doesn't exist and cannot be updated");
}
supplementalDiagnosisCategories.splmtl_diag_cat_id = entity.splmtl_diag_cat_id;
supplementalDiagnosisCategories.splmtl_diag_cat = entity.splmtl_diag_cat;
supplementalDiagnosisCategories.user_intrfc_sort_ord = entity.user_intrfc_sort_ord;
supplementalDiagnosisCategories.splmtl_diag_cat_stat = entity.splmtl_diag_cat_stat;
supplementalDiagnosisCategories.splmtl_diag_cat_strt_eff_dt = entity.splmtl_diag_cat_strt_eff_dt;
supplementalDiagnosisCategories.splmtl_diag_cat_end_eff_dt = entity.splmtl_diag_cat_end_eff_dt;
supplementalDiagnosisCategories.rec_updt_user_id_cd = entity.rec_updt_user_id_cd;
supplementalDiagnosisCategories.rec_updt_dt = entity.rec_updt_dt;
ctx.Entry(supplementalDiagnosisCategories).State = System.Data.Entity.EntityState.Modified;
int result = ctx.SaveChanges();
return result;
}
}
catch ( DbEntityValidationException ex )
{
throw ex;
}
catch ( EntityException ex )
{
throw ex;
}
catch ( Exception ex )
{
throw ex;
}
}