Beispiel #1
0
 public bool UpdateUserSkill(UserSkillDetails model)
 {
     using (var ctx = new ApplicationDbContext())
     {
         var entity =
             ctx
             .UserSkills
             .Single(e => e.UserSkillId == model.UserSkillId);
         entity.Skill = model.Skill;
         return(ctx.SaveChanges() == 1);
     }
 }
Beispiel #2
0
        public IHttpActionResult Put(UserSkillDetails userSkill)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateUserSkillService();

            if (!service.UpdateUserSkill(userSkill))
            {
                return(InternalServerError());
            }

            string newLog     = "Skill Updated";
            var    logService = CreateLogService();

            logService.LogCreate(newLog);

            return(Ok(newLog));
        }