public Associate PutAssociate(long id, AssociateList associate)
        {
            foreach (var asso in associate.Associate_Skills)
            {
                asso.Associate_ID = id;
            }
            Associate associateObj = new Associate
            {
                ID           = associate.ID,
                Associate_ID = associate.Associate_ID,
                Name         = associate.Name,
                Email        = associate.Email,
                Mobile       = associate.Mobile,
                Gender       = associate.Gender,
                Level_1      = associate.Level_1,
                Level_2      = associate.Level_2,
                Level_3      = associate.Level_3,
                Status_Green = associate.Status_Green,
                Status_Blue  = associate.Status_Blue,
                Status_Red   = associate.Status_Red,
                Pic          = associate.Pic,
                Remark       = associate.Remark,
                Other_Skills = associate.Other_Skills,
                Strength     = associate.Strength,
                Weakness     = associate.Weakness
            };
            List <Associate_Skills> Askills = associate.Associate_Skills.Select(askill => new Associate_Skills {
                ID = askill.ID, Skill_ID = askill.Skill_ID, Associate_ID = askill.Associate_ID, Skill_Score = askill.Skill_Score
            }).ToList();

            this.DeleteAssociate_Skills(id);
            associateObj.Associate_Skills = null;
            db = new SkillTrackerDBEntities();
            db.Entry(associateObj).State = EntityState.Modified;
            db.SaveChanges();
            if (Askills != null && Askills.Count > 0)
            {
                this.PostAssociate_Skills(Askills);
            }

            Associate associateUpdated = db.Associates.Find(id);

            return(associateUpdated);
        }
        public Associate PostAssociate(Associate associate)
        {
            db.Associates.Add(associate);
            db.SaveChanges();

            AssociateList associateObj = new AssociateList
            {
                ID               = associate.ID,
                Associate_ID     = associate.Associate_ID,
                Name             = associate.Name,
                Email            = associate.Email,
                Mobile           = associate.Mobile,
                Gender           = associate.Gender,
                Level_1          = associate.Level_1,
                Level_2          = associate.Level_2,
                Level_3          = associate.Level_3,
                Status_Green     = associate.Status_Green,
                Status_Blue      = associate.Status_Blue,
                Status_Red       = associate.Status_Red,
                Pic              = associate.Pic,
                Remark           = associate.Remark,
                Other_Skills     = associate.Other_Skills,
                Strength         = associate.Strength,
                Weakness         = associate.Weakness,
                Associate_Skills = associate.Associate_Skills.Select(s => new Associate_Skills_List
                {
                    ID           = s.ID,
                    Associate_ID = s.Associate_ID,
                    Skill_ID     = s.Skill_ID,
                    Skill_Score  = s.Skill_Score,
                    Skill        = s.Skill == null ? null: new Skill_List {
                        Skill_ID = s.Skill.Skill_ID, Skill_Name = s.Skill.Skill_Name
                    }
                }).ToList()
            };

            return(associate);
        }