public int Insert(VacationsDetails VacationDetail) { try { using (var db = new HCMEntities()) { db.VacationsDetails.Add(VacationDetail); db.SaveChanges(); return(VacationDetail.VacationDetailID); } } catch { throw; } }
public int Delete(int VacationDetailID, int UserIdentity) { try { using (var db = new HCMEntities()) { VacationsDetails VacationDetailObj = db.VacationsDetails.FirstOrDefault(x => x.VacationDetailID.Equals(VacationDetailID)); db.VacationsDetails.Remove(VacationDetailObj); return(db.SaveChanges(UserIdentity)); } } catch { throw; } }
public int UpdateCreationDates(VacationsDetails VacationDetail) { try { using (var db = new HCMEntities()) { VacationsDetails VacationDetailObj = db.VacationsDetails.FirstOrDefault(x => x.VacationID.Equals(VacationDetail.VacationID)); VacationDetailObj.FromDate = VacationDetail.FromDate; VacationDetailObj.ToDate = VacationDetail.ToDate; VacationDetailObj.Notes = VacationDetail.Notes; VacationDetailObj.LastUpdatedBy = VacationDetail.LastUpdatedBy; VacationDetailObj.LastUpdatedDate = VacationDetail.LastUpdatedDate; return(db.SaveChanges()); } } catch { throw; } }
public int Update(VacationsDetails VacationDetail) { try { using (var db = new HCMEntities()) { VacationsDetails VacationDetailObj = db.VacationsDetails.FirstOrDefault(x => x.VacationDetailID.Equals(VacationDetail.VacationDetailID)); VacationDetailObj.IsApproved = VacationDetail.IsApproved; VacationDetailObj.ApprovedBy = VacationDetail.ApprovedBy; VacationDetailObj.ApprovedDate = VacationDetail.ApprovedDate; VacationDetailObj.LastUpdatedBy = VacationDetail.LastUpdatedBy; VacationDetailObj.LastUpdatedDate = VacationDetail.LastUpdatedDate; return(db.SaveChanges()); } } catch { throw; } }