public long SetEducation(EDUCATON Education, long HumanID)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             //long HumanID = 60111;
             //EDUCATON Education = new EDUCATON();
             //Education.EDUCATIONBRANCH = "asd";
             //Education.EDUCATIONDIPLOMA = "asd";
             //Education.EDUCATIONDURATION = 12;
             //Education.EDUCATIONLOCATION = "asd";
             //Education.FINALGRADE = 12;
             db.Configuration.ProxyCreationEnabled = false;
             db.EDUCATONS.Add(Education);
             db.SaveChanges();
             OWNERSEDUCATION owenersEducation = new OWNERSEDUCATION();
             owenersEducation.EDUCATIONID      = Education.ID;
             owenersEducation.EDUCATIONOWNERID = HumanID;
             db.OWNERSEDUCATIONS.Add(owenersEducation);
             db.SaveChanges();
             return(Education.ID);
         }
         catch
         {
             return(0);
         }
     }
 }
 public bool UpdateEducation(EDUCATON Entity)
 {
     using (KARYABDBEntities db = new KARYABDBEntities())
     {
         try
         {
             // var Skill = db.SKILLS.FirstOrDefault(q => q.ID == SkillID);
             db.EDUCATONS.Attach(Entity);
             var Entry = db.Entry(Entity);
             Entry.State = EntityState.Modified;
             db.SaveChanges();
             return(true);
         }
         catch (Exception e)
         {
             return(false);
         }
     }
 }
        public bool DeleteEducation(EDUCATON Entity)
        {
            using (KARYABDBEntities db = new KARYABDBEntities())
            {
                try
                {
                    db.Configuration.ProxyCreationEnabled = false;
                    EDUCATON        entity = db.EDUCATONS.FirstOrDefault(q => q.ID == Entity.ID);
                    OWNERSEDUCATION Owner  = db.OWNERSEDUCATIONS.FirstOrDefault(q => q.EDUCATIONID == Entity.ID);
                    db.OWNERSEDUCATIONS.Attach(Owner);
                    db.OWNERSEDUCATIONS.Remove(Owner);
                    db.SaveChanges();
                    db.EDUCATONS.Attach(entity);
                    db.EDUCATONS.Remove(entity);
                    db.SaveChanges();

                    return(true);
                }
                catch (Exception e)
                {
                    return(false);
                }
            }
        }