Esempio n. 1
0
 public int Delete(int GeneralSpecializationID, int UserIdentity)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             GeneralSpecializations GeneralSpecializationObj = db.GeneralSpecializations.SingleOrDefault(x => x.GeneralSpecializationID.Equals(GeneralSpecializationID));
             db.GeneralSpecializations.Remove(GeneralSpecializationObj);
             return(db.SaveChanges(UserIdentity));
         }
     }
     catch
     {
         throw;
     }
 }
Esempio n. 2
0
 public int Update(GeneralSpecializations GeneralSpecialization)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             GeneralSpecializations GeneralSpecializationObj = db.GeneralSpecializations.SingleOrDefault(x => x.GeneralSpecializationID.Equals(GeneralSpecialization.GeneralSpecializationID));
             GeneralSpecializationObj.GeneralSpecializationName = GeneralSpecialization.GeneralSpecializationName;
             GeneralSpecializationObj.QualificationID           = GeneralSpecialization.QualificationID;
             GeneralSpecializationObj.DirectPoints    = GeneralSpecialization.DirectPoints;
             GeneralSpecializationObj.IndirectPoints  = GeneralSpecialization.IndirectPoints;
             GeneralSpecializationObj.LastUpdatedDate = GeneralSpecialization.LastUpdatedDate;
             GeneralSpecializationObj.LastUpdatedBy   = GeneralSpecialization.LastUpdatedBy;
             return(db.SaveChanges());
         }
     }
     catch
     {
         throw;
     }
 }
Esempio n. 3
0
 public int Insert(GeneralSpecializations GeneralSpecialization)
 {
     try
     {
         using (var db = new HCMEntities())
         {
             db.GeneralSpecializations.Add(GeneralSpecialization);
             db.SaveChanges();
             return(GeneralSpecialization.GeneralSpecializationID);
         }
     }
     catch (DbEntityValidationException e)
     {
         foreach (var eve in e.EntityValidationErrors)
         {
             Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:", eve.Entry.Entity.GetType().Name, eve.Entry.State);
             foreach (var ve in eve.ValidationErrors)
             {
                 Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"", ve.PropertyName, ve.ErrorMessage);
             }
         }
         throw;
     }
 }