Esempio n. 1
0
 public bool UpdateItSkills(ITSkills ITSkills, int UserId)
 {
     using (var connection = new SqlConnection(connectionString))
     {
         try
         {
             SqlParameter[] parameters = new SqlParameter[] {
                 new SqlParameter("@ITSkillId", ITSkills.Id),
                 new SqlParameter("@ITSkill", ITSkills.Skill),
                 new SqlParameter("@SkillVersion", ITSkills.SkillVersion),
                 new SqlParameter("@LastUsed", ITSkills.LastUsed),
                 new SqlParameter("@ExperienceYear", ITSkills.ExperienceYear),
                 new SqlParameter("@ExperienceMonth", ITSkills.ExperienceMonth),
                 new SqlParameter("@UserId", UserId),
             };
             var result =
                 SqlHelper.ExecuteNonQuery
                 (
                     connection,
                     CommandType.StoredProcedure,
                     "usp_UpdateITSkills",
                     parameters
                 );
             if (result > 0)
             {
                 return(true);
             }
         }
         finally
         {
             SqlHelper.CloseConnection(connection);
         }
     }
     throw new UserNotCreatedException("Unable to create IT Skill, please contact your teck deck with your details.");
 }
Esempio n. 2
0
        public IActionResult UpdateITSkill([FromBody] ITSkills ITSkills)
        {
            var result = false;

            if (ITSkills != null)
            {
                var user = HttpContext.Session.Get <UserViewModel>(Constants.SessionKeyUserInfo);
                user = user ?? new UserViewModel();
                try
                {
                    result = userProfileHandler.UpdateItSkills(ITSkills, user.UserId);
                }
                catch (InvalidUserCredentialsException ex)
                {
                    Logger.Logger.WriteLog(Logger.Logtype.Error, ex.Message, user.UserId, typeof(JobSeekerManagementController), ex);
                    ModelState.AddModelError("ErrorMessage", string.Format("{0}", ex.Message));
                }
                catch (UserNotCreatedException ex)
                {
                    Logger.Logger.WriteLog(Logger.Logtype.Error, ex.Message, user.UserId, typeof(JobSeekerManagementController), ex);
                    ModelState.AddModelError("ErrorMessage", string.Format("{0}", ex.Message));
                }
                return(Json(result));
            }
            else
            {
                return(Json(result));
            }
        }
Esempio n. 3
0
        public bool UpdateItSkills(ITSkills ITSkills, int UserId)
        {
            var skill = new ITSkills
            {
                Id              = ITSkills.Id,
                Skill           = ITSkills.Skill,
                SkillVersion    = ITSkills.SkillVersion,
                LastUsed        = ITSkills.LastUsed,
                ExperienceYear  = ITSkills.ExperienceYear,
                ExperienceMonth = ITSkills.ExperienceMonth
            };
            bool isAdded = _userProfileRepository.UpdateItSkills(skill, UserId);

            if (isAdded)
            {
                return(true);
            }
            throw new UserNotCreatedException("Unable to create skills, please contact your teck deck.");
        }