public Boolean InsertDeleteEmpHistory(UserEmployerHistory obj, string Status) { Boolean res = false; try { //using (var context = new Cubicle_EntityEntities()) //{ // if (Status == "I") // { // context.Entry(obj).State = System.Data.EntityState.Added; // context.SaveChanges(); // res = true; // } // if (Status == "U") // { // var val = context.UserEmployerHistories.FirstOrDefault(p => p.UserEmployerHistoryID == obj.UserEmployerHistoryID); // if (val != null) // { // val.UserID = obj.UserID; // val.CompanyName = obj.CompanyName; // val.DurationFrom = obj.DurationFrom; // val.DurationTo = obj.DurationTo; // val.Currentemployer = obj.Currentemployer; // context.Entry(val).State = System.Data.EntityState.Modified; // context.SaveChanges(); // res = true; // } // } // if (Status == "D") // { // var val = context.UserEmployerHistories.FirstOrDefault(p => p.UserEmployerHistoryID == obj.UserEmployerHistoryID); // if (val != null) // { // context.Entry(val).State = System.Data.EntityState.Deleted; // context.SaveChanges(); // res = true; // } // } //} } catch (Exception ex) { //bool false = BusinessLogicExceptionHandler.HandleException(ref ex); if (false) { throw ex; } } return(res); }
public UserEmployerHistory GetEmployeeHistoryByID(int EmpHistoryID) { UserEmployerHistory list = null; try { //using (var db = new Cubicle_EntityEntities()) //{ // list = db.UserEmployerHistories.FirstOrDefault(a=> a.UserEmployerHistoryID == EmpHistoryID) ; //} } catch (Exception ex) { //bool false = BusinessLogicExceptionHandler.HandleException(ref ex); if (false) { throw ex; } } return(list); }