Beispiel #1
0
 public int Delete(int ScholarshipDetailID, int UserIdentity)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             ScholarshipsDetails ScholarshipDetailObj = db.ScholarshipsDetails.FirstOrDefault(x => x.ScholarshipDetailID.Equals(ScholarshipDetailID));
             db.ScholarshipsDetails.Remove(ScholarshipDetailObj);
             return(db.SaveChanges(UserIdentity));
         }
     }
     catch
     {
         throw;
     }
 }
Beispiel #2
0
 public int Insert(ScholarshipsDetails ScholarshipDetail)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             db.ScholarshipsDetails.Add(ScholarshipDetail);
             db.SaveChanges();
             return(ScholarshipDetail.ScholarshipDetailID);
         }
     }
     catch
     {
         throw;
     }
 }
Beispiel #3
0
        //public int Update(ScholarshipsDetails ScholarshipDetail)
        //{
        //    try
        //    {
        //        using (var db = new HCMEntities())
        //        {
        //            ScholarshipsDetails ScholarshipDetailObj = db.ScholarshipsDetails.FirstOrDefault(x => x.ScholarshipDetailID.Equals(ScholarshipDetail.ScholarshipDetailID));
        //            ScholarshipDetailObj.LastUpdatedBy = ScholarshipDetail.LastUpdatedBy;
        //            ScholarshipDetailObj.LastUpdatedDate = ScholarshipDetail.LastUpdatedDate;
        //            return db.SaveChanges();
        //        }
        //    }
        //    catch
        //    {
        //        throw;
        //    }
        //}

        public int UpdateCreationDates(ScholarshipsDetails ScholarshipDetail)
        {
            try
            {
                using (var db = new HCMEntities())
                {
                    ScholarshipsDetails ScholarshipDetailObj = db.ScholarshipsDetails.FirstOrDefault(x => x.ScholarshipID.Equals(ScholarshipDetail.ScholarshipID));
                    ScholarshipDetailObj.FromDate        = ScholarshipDetail.FromDate;
                    ScholarshipDetailObj.ToDate          = ScholarshipDetail.ToDate;
                    ScholarshipDetailObj.LastUpdatedBy   = ScholarshipDetail.LastUpdatedBy;
                    ScholarshipDetailObj.LastUpdatedDate = ScholarshipDetail.LastUpdatedDate;
                    return(db.SaveChanges());
                }
            }
            catch
            {
                throw;
            }
        }