Ejemplo n.º 1
0
 public HttpResponseMessage UpdateNewsBlog(NewsBlogs obj)
 {
     try
     {
         string msg       = string.Empty;
         var    _newsBlog = _newsBlogsRepo.Find(x => x.Id == obj.Id && x.UserId == obj.UserId && x.IsDeleted == false).FirstOrDefault();
         if (_newsBlog != null)
         {
             _newsBlog.PageId       = obj.PageId;
             _newsBlog.Category     = obj.Category;
             _newsBlog.ContentText  = obj.ContentText;
             _newsBlog.NewsTitle    = obj.NewsTitle;
             _newsBlog.ImageURL     = obj.ImageURL;
             _newsBlog.ModifiedBy   = obj.UserId;
             _newsBlog.ModifiedDate = System.DateTime.Now;
             _newsBlogsRepo.Update(_newsBlog);
             return(Request.CreateResponse(HttpStatusCode.Accepted, "Updated"));
         }
         else
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound, "Not Found"));
         }
     }
     catch (System.Exception ex)
     {
         return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
     }
 }
Ejemplo n.º 2
0
        public HttpResponseMessage GetAllNewsBlogs([FromUri] NewsBlogs newsBlogs, string Type)
        {
            var result = _newsBlogsRepo.Find(
                x => x.Category == Type &&
                (newsBlogs.UserId == null || newsBlogs.UserId.Contains(x.UserId)) &&
                (newsBlogs.NewsCategory == null || x.NewsCategory.ToUpper().Contains(newsBlogs.NewsCategory.ToUpper())) &&
                (newsBlogs.NewsTitle == null || x.NewsTitle.ToUpper().Contains(newsBlogs.NewsTitle.ToUpper()))).OrderByDescending(x => x.Id).Take(15).ToList();

            return(Request.CreateResponse(HttpStatusCode.Accepted, result));
        }
Ejemplo n.º 3
0
        public HttpResponseMessage SavePatientPrescription(NewsBlogs obj)
        {
            var _prescriptionCreated = _newsBlogsRepo.Insert(obj);

            return(Request.CreateResponse(HttpStatusCode.Accepted, obj.Id));
        }
Ejemplo n.º 4
0
        // Decides how to search in websites based on query
        private async void InputQueryToWebsites()
        {
            await Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                if (query == "" || query == null)
                {
                    // Gets query for other uses.
                    query = NewMessageTextBox.Text;
                }

                // Strip query of punctuation & make lowercase
                query = CleanInput(query);

                // Get subject of query (topic of your knowledge base)
                if (set1.Contains(query))
                {
                    if (query == kbName1)
                    {
                        subject = " ";                         // don't add a subject if query is already subject word
                    }
                    else
                    {
                        subject = kbName1;
                    }
                }
                else if (set2.Contains(query))
                {
                    if (query == kbName2)
                    {
                        subject = "";                         // don't add a subject if query is already subject word
                    }
                    else
                    {
                        subject = kbName2;
                    }
                }
                else if (set3.Contains(query))
                {
                    if (query == kbName3)
                    {
                        subject = "";                         // don't add a subject if query is already subject word
                    }
                    else
                    {
                        subject = kbName3;
                    }
                }
                else                 // if no subject, then must be a LUIS default intent (Greeting, Cancel, Help, or None)
                {
                    subject = "";
                    query   = "";

                    // Sites need the root URLs to render, rather than empty query/subject in URL
                    Encyclopedia.Navigate(new Uri("https://en.wikipedia.org/"));
                    MicrosoftAcademic.Navigate(new Uri("https://academic.microsoft.com/"));
                    NewsBlogs.Navigate(new Uri("https://www.bing.com/"));
                    return;
                }

                // Set query into Encyclopedia, Microsoft Academics, and Bing Search
                Encyclopedia.Navigate(new Uri("https://en.wikipedia.org/w/index.php?search=" + query + "+" + subject + "&title=Special%3ASearch&go=Go"));
                NewsBlogs.Navigate(new Uri("https://www.bing.com/search?q=" + query + "+" + subject));
                MicrosoftAcademic.Navigate(new Uri("https://academic.microsoft.com/#/search?iq=%40" + query + "%20" + subject + "%40&q=" + query + "%20" + subject));
            });

            // Clears text for next query.
            await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
            {
                NewMessageTextBox.Text = String.Empty;
            });

            query = "";
        }
        // Decides how to search in websites based on query
        private void inputQueryToWebsites()
        {
            // Gets query for other uses.
            query = NewMessageTextBox.Text;

            // Strip query of punctuation
            query = CleanInput(query);

            // Get subject of query (topic of your knowledge base)
            if (set1.Contains(query))
            {
                if (query == kbName1)
                {
                    subject = " "; // don't add a subject if query is already subject word
                }
                else
                {
                    subject = kbName1;
                }
            }
            else if (set2.Contains(query))
            {
                if (query == kbName2)
                {
                    subject = " "; // don't add a subject if query is already subject word
                }
                else
                {
                    subject = kbName2;
                }
            }
            else if (set3.Contains(query))
            {
                if (query == kbName3)
                {
                    subject = " "; // don't add a subject if query is already subject word
                }
                else
                {
                    subject = kbName3;
                }
            }
            else // if no subject, then must be a LUIS default intent (Greeting, Cancel, Help, or None)
            {
                subject = "";
                query   = "";

                // Microsoft academic needs the root URL to render, rather than empty query/subject in URL
                MicrosoftAcademic.Navigate(new Uri("https://academic.microsoft.com/"));
            }

            // Set query into Encyclopedia, Microsoft Academics, and Bing Search
            Encyclopedia.Navigate(new Uri("https://en.wikipedia.org/wiki/" + query));
            NewsBlogs.Navigate(new Uri("https://www.bing.com/search?q=" + query + "%20" + subject + "&qs=n&form=QBRE&sp=-1&pq=" + query + "%20" + subject + "&sc=8-5&sk=&cvid=92D86BDF64C049B3AD2DC5444AB33E25"));

            if (subject != "" && query != "")
            {
                MicrosoftAcademic.Navigate(new Uri("https://academic.microsoft.com/#/search?iq=@" + query + "@&q=" + query + "&filters=&from=0&sort=0"));
            }

            // Clears text for next query.
            NewMessageTextBox.Text = String.Empty;
        }
Ejemplo n.º 6
0
        public HttpResponseMessage SaveNewsBlog(NewsBlogs obj)
        {
            var _newsBlogCreated = _newsBlogsRepo.Insert(obj);

            return(Request.CreateResponse(HttpStatusCode.Accepted, "Saved"));
        }