public ActionResult <bool> Insert([FromBody] JsonElement jsonValue) { try { var value = JsonElementHelper.GetString(jsonValue); var blogPostDto = JsonConvert.DeserializeObject <BlogPostDto>(value); _blogPostService.InsertBlogPost(blogPostDto); return(true); } catch (Exception ex) { return(false); } }
public ActionResult <bool> Put([FromBody] JsonElement jsonValue) { try { var value = JsonElementHelper.GetString(jsonValue); var blogInfo = JsonConvert.DeserializeObject <BlogDto>(value); _blogService.UpdateBlog(blogInfo); return(true); } catch (Exception ex) { return(false); } }
public ActionResult <bool> InsertNewUser([FromBody] JsonElement userInfo) { var userInformation = JsonConvert.DeserializeObject <UserInfoDto>(JsonElementHelper.GetString(userInfo)); var isExists = _userInfoService.CheckUserExists(userInformation); if (isExists) { return(false); } var encryptedInfo = _userInfoService.GetEncryptedInfo(userInformation); userInformation.Password = encryptedInfo; _userInfoService.InsertUserInfo(userInformation); return(true); }
public ActionResult <List <BlogPostListItemDto> > Search([FromBody] JsonElement jsonValue) { var value = JsonElementHelper.GetString(jsonValue); return(_blogPostService.GetBlogPostListBySearchTerm(value)); }