コード例 #1
0
        public async Task <IActionResult> AddSkill([FromBody] AddSkillViewModel skill)
        {
            try
            {
                var result = await _profileService.AddNewSkill(skill);

                if (result == false)
                {
                    return(Json(new { Success = false, data = "can not add the skill." }));
                }
                return(Json(new { Success = true, data = "add successful" }));
            }
            catch (Exception e)
            {
                return(Json(new { Success = false, data = "error" }));
            }
        }
コード例 #2
0
ファイル: ProfileController.cs プロジェクト: stimulate/Talent
        public async Task <ActionResult> AddSkill([FromBody] AddSkillViewModel skill)
        {
            try
            {
                // if (ModelState.IsValid)
                // {
                var user = (await _userRepository.GetByIdAsync(_userAppContext.CurrentUserId));
                var x    = await _profileService.AddNewSkill(skill);

                return(Json(new { success = x }));
                // }
                // return Json(new { success = false });
            }
            catch (Exception e)
            {
                return(Json(new { Success = false, message = e }));
            }
        }
コード例 #3
0
 public ActionResult AddSkill([FromBody] AddSkillViewModel skill)
 {
     //Your code here;
     _profileService.AddNewSkill(skill);
     return(Json(new { Success = true }));
 }