private int DeleteTblEmployeeShiftStore(TblEmployeeShiftStore row) { using (var context = new TimeAttEntities()) { var oldRow = (from e in context.TblEmployeeShiftStores where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }
private TblEmployeeShiftStore UpdateOrInsertTblEmployeeShiftStore(TblEmployeeShiftStore newRow, bool save, int index, out int outindex) { outindex = index; using (var context = new TimeAttEntities()) { if (save) { context.TblEmployeeShiftStores.AddObject(newRow); } else { var oldRow = (from e in context.TblEmployeeShiftStores where e.Iserial == newRow.Iserial select e).SingleOrDefault(); if (oldRow != null) { Operations.SharedOperation.GenericUpdate(oldRow, newRow, context); } } context.SaveChanges(); return(newRow); } }