コード例 #1
0
 public async Task <string> AddNewsItems(News_Properties items)//locahost:44355
 {
     if (items.News_Content.Length > 0)
     {
         try
         {
             items.NoOfCol  = (items.NoOfCol == 0) ? 4 : items.NoOfCol;
             items.NoOfCol  = (items.NoOfRow == 0) ? 6 : items.NoOfRow;
             items.ColWidth = (items.ColWidth == 0) ? 9 : items.ColWidth;
             var         li    = _services.CreateNewsLines(items.News_Content, items.ColWidth);
             List <Page> pages = (List <Page>)_logic.Logic(li, items.NoOfCol, items.NoOfRow);
             _services.JsonSerialize(pages);
             HttpClient hc = new HttpClient();
             hc.BaseAddress = new Uri("https://localhost:44397/v1/");
             var apiempctrl = hc.GetAsync("GetNewsItems");
             apiempctrl.Wait();
             return("Successful");
         }
         catch (Exception e)
         {
             return(e.ToString());
         }
     }
     else
     {
         return("Unsuccessful");
     }
 }