public string SaveData(MERGED_Data dr) { using (var contextAR = new TestDB_UpdatedEntities()) { try { contextAR.MERGED_Data.Add(dr); contextAR.SaveChanges(); return("saved"); } catch (Exception ex) { return(ex.ToString()); } } }
public string DeleteRecord(double unitnm) { using (var contextAR = new TestDB_UpdatedEntities()) { try { var data = contextAR.MERGED_Data.Where(i => i.UNITID == unitnm).FirstOrDefault(); contextAR.MERGED_Data.Remove(data); contextAR.SaveChanges(); return("saved"); } catch (Exception ex) { return(ex.ToString()); } } }