コード例 #1
0
 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);
     }
 }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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);
        }
コード例 #4
0
        public ActionResult <List <BlogPostListItemDto> > Search([FromBody] JsonElement jsonValue)
        {
            var value = JsonElementHelper.GetString(jsonValue);

            return(_blogPostService.GetBlogPostListBySearchTerm(value));
        }