public static bool AddCapex(AssetBudget astBud) { try { using (BudgetCaptureDBEntities db = new BudgetCaptureDBEntities()) { db.AssetBudgets.Add(astBud); db.SaveChanges(); return(true); } } catch (Exception ex) { // Utility.WriteError("Error Msg: " + ex.Message); throw ex; } }
public static bool DeleteCapex(AssetBudget astBud) { try { bool rst = false; using (var db = new BudgetCaptureDBEntities()) { db.Entry(astBud).State = System.Data.Entity.EntityState.Deleted; db.SaveChanges(); rst = true; } return(rst); } catch (Exception ex) { throw ex; } }
public static bool UpdateCapex(AssetBudget astBud) { try { bool rst = false; using (var db = new BudgetCaptureDBEntities()) { db.AssetBudgets.Attach(astBud); db.Entry(astBud).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); rst = true; } return(rst); } catch (Exception ex) { // Utility.WriteError("Error Msg: " + ex.Message); throw ex; } }