public int Delete(Lenders Lender, int UserIdentity) { try { using (var db = new HCMEntities()) { Lenders LenderObj = db.Lenders.SingleOrDefault(x => x.LenderID.Equals(Lender.LenderID)); db.Lenders.Remove(LenderObj); return(db.SaveChanges(UserIdentity)); } } catch { throw; } }
public int Insert(Lenders Lender) { try { using (var db = new HCMEntities()) { db.Lenders.Add(Lender); db.SaveChanges(); return(Lender.LenderID); } } catch { throw; } }
public int EndLender(Lenders Lender) { try { using (var db = new HCMEntities()) { Lenders LenderObj = db.Lenders.SingleOrDefault(x => x.LenderID.Equals(Lender.LenderID)); LenderObj.LenderStartDate = Lender.LenderStartDate; LenderObj.LenderEndDate = Lender.LenderEndDate; LenderObj.EmployeeCareerHistoryID = Lender.EmployeeCareerHistoryID; LenderObj.IsFinished = Lender.IsFinished; LenderObj.LenderOrganization = Lender.LenderOrganization; LenderObj.KSACityID = Lender.KSACityID; LenderObj.LenderEndReason = "" + Lender.LenderEndReason; LenderObj.LastUpdatedDate = Lender.LastUpdatedDate; LenderObj.LastUpdatedBy = Lender.LastUpdatedBy; return(db.SaveChanges()); } } catch { throw; } }