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" })); } }
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 })); } }
public ActionResult AddSkill([FromBody] AddSkillViewModel skill) { //Your code here; _profileService.AddNewSkill(skill); return(Json(new { Success = true })); }