public int Insert(Scholarships EmployeeScholarship) { try { using (var db = new HCMEntities()) { db.Scholarships.Add(EmployeeScholarship); db.SaveChanges(); return(EmployeeScholarship.ScholarshipID); } } catch (Exception ex) { throw ex; } }
public int Delete(Scholarships EmployeeScholarship, int UserIdentity) { try { using (var db = new HCMEntities()) { Scholarships EmployeeScholarshipObj = db.Scholarships.FirstOrDefault(x => x.ScholarshipID.Equals(EmployeeScholarship.ScholarshipID)); db.Scholarships.Remove(EmployeeScholarshipObj); return(db.SaveChanges(UserIdentity)); } } catch (Exception ex) { throw ex; } }
public int UpdateJoinScholarshipStatus(Scholarships EmployeeScholarship) { try { using (var db = new HCMEntities()) { Scholarships EmployeeScholarshipObj = db.Scholarships.FirstOrDefault(x => x.ScholarshipID.Equals(EmployeeScholarship.ScholarshipID)); EmployeeScholarshipObj.ScholarshipStartDate = EmployeeScholarship.ScholarshipStartDate; EmployeeScholarshipObj.ScholarshipEndDate = EmployeeScholarship.ScholarshipEndDate; EmployeeScholarshipObj.ScholarshipJoinDate = EmployeeScholarship.ScholarshipJoinDate; EmployeeScholarshipObj.IsPassed = EmployeeScholarship.IsPassed; EmployeeScholarshipObj.LastUpdatedDate = EmployeeScholarship.LastUpdatedDate; EmployeeScholarshipObj.LastUpdatedBy = EmployeeScholarship.LastUpdatedBy; return(db.SaveChanges()); } } catch (Exception ex) { throw ex; } }