public GenericTable GenericUpdateOrInsert(string tablEname, GenericTable item, int index, out int outindex) { outindex = index; using (var context = new WorkFlowManagerDBEntities()) { if (item.Iserial == 0) { context.sp_GenericInsertIntoTable(tablEname, item.Code, item.Ename, item.Aname.Normalize()); } else { context.sp_GenericUpdateTable(tablEname, item.Iserial.ToString(), item.Code, item.Ename, item.Aname.Normalize()); } context.SaveChanges(); return(GetGeneric(tablEname, item.Code, item.Ename, item.Aname, "Iserial", "Asc").FirstOrDefault()); } }