예제 #1
0
        public async Task <JsonResult <HappyTweet> > InsertHappyTweet(HappyTweet mApp)
        {
            HappyTweetsRepository mRepo = new HappyTweetsRepository(HappyTweetsRepository.DEFAULT_TABLE_NAME, HappyTweetsRepository.DEFAULT_PART_KEY);
            HappyTweet            HappyTweet;

            char[] delim = { ',' };
            if (mApp.Name != null && mApp.TweetMessage != null)
            {
                HappyTweet = new HappyTweet(mApp.Name, mApp.TweetMessage, mApp.Description);
                if (mApp.roles != null)
                {
                    HappyTweet.roles        = mApp.roles;
                    HappyTweet.AllowedRoles = mApp.roles.Split(delim);
                }
                mRepo.InsertHappyTweetDetails(HappyTweet);
                mApp = HappyTweet;
            }

            return(Json <HappyTweet>(mApp));
        }