コード例 #1
0
        public IActionResult addComms()
        {
            var comms = new List <CommunityModel>
            {
                new CommunityModel
                {
                    user_code   = "comm001",
                    enabled_flg = 1,
                    url         = "www.google.ca",
                    title       = "Community 1",
                    desc        = "Descrption for community 1"
                },
                new CommunityModel
                {
                    user_code   = "comm002",
                    enabled_flg = 0,
                    url         = "www.google.ca",
                    title       = "Community 2",
                    desc        = "Descrption for community 2"
                }
            };

            foreach (var item in comms)
            {
                _commconService.addCommunity(item);
            }
            var tmp = _commconService.saveCommunity();

            return(Ok(tmp));
        }
コード例 #2
0
 public IActionResult addComms(CommunityModel obj)
 {
     try
     {
         _commRes.addCommunity(obj);
         _commRes.saveCommunity();
         return(Ok());
     }
     catch
     {
         return(BadRequest());
     }
 }