public async Task <IHttpActionResult> PutTechnicalSkill(int id, TechnicalSkillVM technicalSkillVM)
        {
            TechnicalSkill technicalSkill = ConvertToDBModel(technicalSkillVM);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != technicalSkill.ID)
            {
                return(BadRequest());
            }

            db.Entry(technicalSkill).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TechnicalSkillExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public async Task <IHttpActionResult> PostTechnicalSkill(TechnicalSkillVM technicalSkill)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.TechnicalSkills.Add(ConvertToDBModel(technicalSkill));
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = technicalSkill.ID }, technicalSkill));
        }
 private TechnicalSkill ConvertToDBModel(TechnicalSkillVM ts)
 {
     return(new TechnicalSkill
     {
         ID = ts.ID,
         LoginID = ts.LoginID,
         Title = ts.Title,
         Version = ts.Version,
         LastUsed = ts.LastUsed,
         ExperienceYear = ts.ExperienceYear,
         ExperienceMonth = ts.ExperienceMonth,
         ProfileID = ts.ProfileID,
         DisplayOrder = ts.DisplayOrder,
         UpdatedOn = ts.UpdatedOn
     });
 }