Ejemplo n.º 1
0
 public static void insertQuoteDatabase(List <QuoteFormat> Quotes)
 {
     foreach (QuoteFormat q in Quotes)
     {
         q.User = "******";
         PrincessDb.insertQuote(q);
     }
 }
Ejemplo n.º 2
0
        public void Logout()
        {
            string TokenName = "Token " + User.Identity.Name;

            if (Request.Cookies[TokenName] != null)
            {
                Response.Cookies.Delete(TokenName);
            }
            PrincessDb.disconnect();
        }
Ejemplo n.º 3
0
        public void Post(SearchKeys searchKey)
        {
            switch (searchKey.SearchType)
            {
            case "Title":
                reviews = new List <Review>(PrincessDb.searchReviewByTitle(searchKey.SearchString, searchKey.SortBy));
                break;

            case "Domain":
                reviews = new List <Review>(PrincessDb.searchReviewByDomain(searchKey.SearchString, searchKey.SortBy));
                break;

            case "Writer":
                reviews = new List <Review>(PrincessDb.searchReviewByWriter(searchKey.SearchString, searchKey.SortBy));
                break;

            default:
                reviews = new List <Review>(PrincessDb.searchReviewByTitle(searchKey.SearchString, searchKey.SortBy));
                break;
            }

            string JSONresult = JsonConvert.SerializeObject(reviews);
            string path       = @"C:\PRINCESS\PRINCESS\princess\src\components\JsonData\reviews.json";

            if (System.IO.File.Exists(path))
            {
                System.IO.File.Delete(path);
                using (var tw = new StreamWriter(path, true))
                {
                    tw.WriteLine(JSONresult.ToString());
                    tw.Close();
                }
            }
            else if (!System.IO.File.Exists(path))
            {
                using (var tw = new StreamWriter(path, true))
                {
                    tw.WriteLine(JSONresult.ToString());
                    tw.Close();
                }
            }
        }
Ejemplo n.º 4
0
 public static void insertDomainDb(Domain domain)
 {
     PrincessDb.insertDomain(domain);
 }