private TblUsersApprovalStatu UpdateOrInsertTblUsersApprovalStatus(TblUsersApprovalStatu newRow, bool save, int index, int user, out int outindex) { outindex = index; try { using (var context = new WorkFlowManagerDBEntities()) { if (save) { context.TblUsersApprovalStatus.AddObject(newRow); } else { var oldRow = (from e in context.TblUsersApprovalStatus where e.Iserial == newRow.Iserial select e).SingleOrDefault(); if (oldRow != null) { SharedOperation.GenericUpdate(oldRow, newRow, context); } } context.SaveChanges(); } return(newRow); } catch (Exception) { return(newRow); } }
private int DeleteTblUsersApprovalStatus(TblUsersApprovalStatu row) { using (var context = new WorkFlowManagerDBEntities()) { var oldRow = (from e in context.TblUsersApprovalStatus where e.Iserial == row.Iserial select e).SingleOrDefault(); if (oldRow != null) { context.DeleteObject(oldRow); } context.SaveChanges(); } return(row.Iserial); }