コード例 #1
0
        public IActionResult CreateTweet([FromBody] LciTweetsModel tweet)
        {
            try
            {
                LciTweets objtweet = iMapper.Map <LciTweetsModel, LciTweets>(tweet);

                businessLayer.createTweet(objtweet);
                return(Ok());
            }
            catch (Exception ex)
            {
                return(new StatusCodeResult(StatusCodes.Status500InternalServerError));
            }
        }
コード例 #2
0
        public void createTweet(LciTweets tweet)
        {
            try
            {
                List <LciCategory> objCategory = RepoWrapper.Category.FindAll();

                List <LciSubcategory> objSubCategory = RepoWrapper.SubCategory.FindAll();

                int categoryId = GetCategoryId(tweet.Tweettext, objCategory, objSubCategory);

                //if(categoryId ==0)
                // categoryId = GetSubCategoryId(tweet.Tweettext, objSubCategory);
                tweet.Categoryid = categoryId;
                RepoWrapper.Tweet.Create(tweet);
                RepoWrapper.save();
            }
            catch (Exception ex)
            {
                throw;
            }
        }