// GET: Contents
        public ActionResult Index(int id)
        {
            var myCookie = GetCookie();

            using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
            {
                string tab = "";
                if (myCookie != null)
                {
                    switch (myCookie)
                    {
                    case "pl":
                        tab = contents.Subsections
                              .Where(u => u.Id == id)
                              .FirstOrDefault().content;
                        break;

                    case "en":
                        tab = contents.Subsections
                              .Where(u => u.Id == id)
                              .FirstOrDefault().content_ang;
                        break;
                    }
                }
                else
                {
                    tab = contents.Subsections
                          .Where(u => u.Id == id)
                          .FirstOrDefault().content;
                }
                String str = Server.HtmlDecode(tab);
                ViewBag.Message = CoderUTF8.Decode(str);
            }
            return(View());
        }
 public ActionResult Secure(string id)
 {
     if (id != null)
     {
         using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
         {
             id = CoderUTF8.Encode(id);
             Secure idx = contents.Secures.Where(u => u.link == id).FirstOrDefault();
             Person per = contents.People.Where(u => u.access == 1).FirstOrDefault();
             if (idx != null)
             {
                 ViewBag.Title   = Resources.HomeTexts.YourLoginDate;
                 ViewBag.Message = "<div><dl class='dl-horizontal'></dl><dt>" + Resources.HomeTexts.Login + ":</dt><dd>" + per.username + "</dd><dt>" + Resources.HomeTexts.password + ":</dt><dd>" + per.password + "</dd></div>";
             }
             else
             {
                 ViewBag.Title   = Resources.HomeTexts.ThePasswordRecoverySitelinkDoesNotExist;
                 ViewBag.Message = "<div class='container body-content'><br><img class='media-object img-rounded' src='../Resources/Image/haha_zecora.png' width='210px' height='210px'><br>";
             }
             var t = contents.Secures.Where(u => u.link == id).First();
             contents.Secures.Remove(t);
             contents.SaveChanges();
         }
         return(View());
     }
     else
     {
         return(View("Home/Index"));
     }
 }
Example #3
0
        // POST api/graph
        public string Post([FromBody] IDictionary <string, string> value)
        {
            Boolean log = Authentication(value["username"], value["password"]);

            if (log)
            {
                string str;
                //
                using (damianlukasik3612_crystalsiegeEntities contex = new damianlukasik3612_crystalsiegeEntities())
                {
                    int i = 0;
                    if (contex.Secures.FirstOrDefault() != null)
                    {
                        List <Secure> list_sec = contex.Secures.ToList();
                        i = list_sec.Last().Id;
                        foreach (Secure sc in list_sec)
                        {
                            contex.Secures.Remove(sc);
                        }
                        contex.SaveChanges();
                    }
                    Secure sec = new Secure();
                    sec.Id = i + 1;
                    Random rand = new Random();
                    str      = CoderUTF8.Encode(rand.Next(0, 999).ToString() + value["password"] + rand.Next(0, 999).ToString());
                    sec.link = str;
                    contex.Secures.Add(sec);
                    contex.SaveChanges();
                }
                //
                return(str);
            }
            return("fail");
        }
        public ActionResult News(int news)
        {
            var myCookie = GetCookie();

            if (news != null)
            {
                using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
                {
                    News          news_ = contents.News.Where(u => u.Id == news).FirstOrDefault();
                    List <String> str   = new List <String>();
                    switch (myCookie)
                    {
                    case "pl":
                        str.Add(CoderUTF8.Decode(news_.title));       //[0]
                        str.Add(CoderUTF8.Decode(news_.description)); //[1]
                        break;

                    case "en":
                        str.Add(CoderUTF8.Decode(news_.title_eng));       //[0]
                        str.Add(CoderUTF8.Decode(news_.description_eng)); //[1]
                        break;
                    }
                    str.Add(news_.author);                                                                                           //[2]
                    str.Add(DecodeDate(news_.date.Value.ToString("G",
                                                                 System.Globalization.CultureInfo.CreateSpecificCulture("en-US")))); //[3]
                    str.Add(Server.HtmlDecode(news_.image));                                                                         //[4]
                    List <News_Tags> news_tags = news_.News_Tags.ToList();
                    String           tagi      = "";
                    switch (myCookie)
                    {
                    case "pl":
                        foreach (News_Tags nt in news_tags)
                        {
                            tagi += " <span class='label label-success' style='background-color: " + nt.Tag.color + "'>" + nt.Tag.tags_pl + "</span> ";
                        }
                        break;

                    case "en":
                        foreach (News_Tags nt in news_tags)
                        {
                            tagi += " <span class='label label-success' style='background-color: " + nt.Tag.color + "'>" + nt.Tag.tags + "</span> ";
                        }
                        break;
                    }
                    str.Add(tagi);//[5]
                    ViewBag.Message = str;
                }
                return(View());
            }
            return(View("~/Views/Home/Index.cshtml"));
        }
Example #5
0
 private Boolean Authentication(string username_, string password_)
 {
     using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
     {
         Person person = contents.People
                         .Where(u => u.username == username_ && u.password == password_)
                         .FirstOrDefault();
         if (person != null)
         {
             return(true);
         }
     }
     return(false);
 }
        public List <String[]> ReadCarouselInfo()
        {
            var myCookie = GetCookie();

            List <String[]> dane = new List <String[]>();

            using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
            {
                List <CarouselInfo> tab = contents.CarouselInfoes.ToList();

                foreach (CarouselInfo wart in tab)
                {
                    if (wart.Link == "")
                    {
                        wart.Link = "http://crystalsiege.eu/";
                    }
                    else
                    {
                        wart.Link = CoderUTF8.Decode(wart.Link);
                    }
                    switch (myCookie)
                    {
                    case "en":
                        String[] str2 =
                        {
                            CoderUTF8.Decode(wart.Title_ang),
                            CoderUTF8.Decode(wart.Description_ang),
                            wart.image,
                            wart.Link
                        };
                        dane.Add(str2);
                        break;

                    case "pl":
                        String[] str1 =
                        {
                            CoderUTF8.Decode(wart.Title),
                            CoderUTF8.Decode(wart.Description),
                            wart.image,
                            wart.Link
                        };
                        dane.Add(str1);
                        break;
                    }
                }
                return(dane);
            }
            return(dane);
        }
        public static List <String> GetImage()
        {
            List <String> dane = new List <String>();

            using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
            {
                string directory = AppDomain.CurrentDomain.BaseDirectory + "\\Resources\\Image";
                IEnumerable <string> filenames = System.IO.Directory.EnumerateFiles(directory, "*.*");

                foreach (String filename in filenames)
                {
                    String[] tab = filename.Split('\\');
                    string   s   = tab[tab.Length - 1];
                    if (s == "haha_zecora.png")
                    {
                        continue;
                    }
                    dane.Add(s);
                }
            }
            return(dane);
        }
        public Dictionary <String, int> ReadAllMonthsNews()
        {
            Dictionary <String, int> result = new Dictionary <String, int>();
            List <String>            months = new List <String>();

            using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
            {
                List <News> news = contents.News.OrderByDescending(s => s.date).ToList();
                if (news.Count == 0)
                {
                    return(null);
                }
                foreach (News wart in news)
                {
                    DateTime wart_date = wart.date.Value;
                    months.Add(DecodeDateMonths(wart_date.Month.ToString()));
                }
                //-----
                result.Add(months[0], 1);
                for (int i = 1; i < months.Count; i++)
                {
                    String month = months[i];

                    if (result.ContainsKey(month))
                    {
                        result[month] = result[month] + 1;
                    }
                    else
                    {
                        result.Add(month, 1);
                    }
                }
                return(result);
            }
            return(result);
        }
Example #9
0
        public async Task <ActionResult> Connect(string username, string password, string secure)//, string secure)
        {
            String returnUrl = "../Home/Index";

            //  try
            //  {

            /*      password = Decrypt(password);
             *    LoginViewModel user = new LoginViewModel();
             *    user.Email = username;
             *    user.Password = password;
             *    user.RememberMe = false;
             *    if (!ModelState.IsValid)
             *    {
             *        return View(user);
             *    }*/
            using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
            {
                Secure sec = contents.Secures.ToList().LastOrDefault();
                if (sec != null)
                {
                    password = Decrypt(password);
                    //   string r = Decrypt(secure);
                    string o = sec.link;

                    if (secure == o)
                    {
                        Person user = contents.People.Where(u => u.password == password && u.username == username).FirstOrDefault();
                        if (user != null)
                        {
                            HttpCookie cookie = new HttpCookie("Session");
                            cookie.Value   = user.Id;
                            cookie.Expires = DateTime.Now.AddDays(2d);
                            Response.SetCookie(cookie);
                            //
                            contents.Secures.Remove(sec);
                            contents.SaveChanges();
                        }
                    }
                }
            }

            /*
             * var result = await SignInManager.PasswordSignInAsync(user.Email, user.Password, user.RememberMe, shouldLockout: false);//wykakuje błąd
             * switch (result)
             * {
             *  case SignInStatus.Success:
             *      return RedirectToLocal(returnUrl);
             *  case SignInStatus.LockedOut:
             *      return View("Lockout");
             *  case SignInStatus.RequiresVerification:
             *      return RedirectToAction("SendCode", new { ReturnUrl = returnUrl, RememberMe = user.RememberMe });
             *  case SignInStatus.Failure:
             *      return View("../Account/Register");
             *  default:
             *      ModelState.AddModelError("", "Invalid login attempt.");
             *      return View(user);
             * }
             * }
             * catch (Exception e)
             * {
             * return View(returnUrl);
             * }    */
            return(View(returnUrl));
        }
        public ActionResult SearchResult(string search)
        {
            string[] searchs = search.Split(' ');//słowa kluczowe

            List <List <string[]> > result      = new List <List <string[]> >();
            List <string[]>         wyniki_news = new List <string[]>();
            List <string[]>         wyniki_cont = new List <string[]>();

            using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
            {//sprawdzać njusy
                List <News> news_list = contents.News.ToList();
                Boolean     log, log_title, log_desc, log_author;
                foreach (News news in news_list)
                {
                    log        = false;
                    log_title  = false;
                    log_desc   = false;
                    log_author = false;
                    string str_title_desc = "";

                    List <News_Tags> news_tags = news.News_Tags.ToList();
                    foreach (News_Tags tg in news_tags)
                    {//po wszystkich tagach
                        string title_ = "";
                        string tags_  = "";
                        switch (Resources.HomeTexts.lang_set)
                        {
                        case "pl":
                            if (Search(tg.Tag.tags_pl, searchs))
                            {
                                title_ = news.title;
                                tags_  = tg.Tag.tags_pl.ToString();
                                log    = true;
                            }
                            break;

                        case "en":
                            if (Search(tg.Tag.tags, searchs))
                            {
                                title_ = news.title_eng;
                                tags_  = tg.Tag.tags.ToString();
                                log    = true;
                            }
                            break;
                        }
                        if (log)
                        {
                            string[] tab_s =
                            {
                                news.Id.ToString(),                                                                                                             //[0]
                                CoderUTF8.Decode(title_),                                                                                                       //[1]
                                "tag " + tg.Tag.color + " " + tags_ + "",                                                                                       //[2]
                                new ContentsController().DecodeDate(news.date.Value.ToString("G",
                                                                                             System.Globalization.CultureInfo.CreateSpecificCulture("en-US"))), //[3]
                                news.author                                                                                                                     //[4]
                            };
                            wyniki_news.Add(tab_s);
                            break;
                        }
                    }
                    if (log)
                    {
                        continue;
                    }
                    if (Search(CoderUTF8.Decode(news.title), searchs))
                    {//po tytule
                        log_title      = true;
                        str_title_desc = Resources.HomeTexts.InTitle;
                    }
                    else if (Search(CoderUTF8.Decode(news.description), searchs))
                    {//po opisie
                        log_desc       = true;
                        str_title_desc = Resources.HomeTexts.InContentNews;
                    }
                    else if (Search(CoderUTF8.Decode(news.author), searchs))
                    {//po nazwie autora
                        log_author     = true;
                        str_title_desc = Resources.HomeTexts.InNameAuthor;
                    }
                    ;
                    if (log_desc || log_title || log_author)
                    {
                        string title_ = "";
                        switch (Resources.HomeTexts.lang_set)
                        {
                        case "pl":
                            title_ = news.title;
                            break;

                        case "en":
                            title_ = news.title_eng;
                            break;
                        }
                        log = true;
                        string[] tab_s =
                        {
                            news.Id.ToString(),                                                                                                             //[0]
                            CoderUTF8.Decode(title_),                                                                                                       //[1]
                            str_title_desc,                                                                                                                 //Tytuł - \" " + CoderUTF8.Decode(wart.title) + "\"",//[2]
                            new ContentsController().DecodeDate(news.date.Value.ToString("G",
                                                                                         System.Globalization.CultureInfo.CreateSpecificCulture("en-US"))), //[3]
                            news.author                                                                                                                     //[4]
                        };
                        wyniki_news.Add(tab_s);
                        continue;
                    }
                }
                //sprawdzać content
                List <Subsection> subs = contents.Subsections.ToList();
                foreach (Subsection sec in subs)
                {
                    switch (Resources.HomeTexts.lang_set)
                    {
                    case "pl":
                        if (Search(CoderUTF8.Decode(sec.title), searchs))
                        {
                            string[] tab_s =
                            {
                                sec.Id.ToString(),                    //[0]
                                CoderUTF8.Decode(sec.title),          //[1]
                                Resources.HomeTexts.InNameSubsection, //- \"" + CoderUTF8.Decode(sec.title) +"\"" ,//[2]
                            };
                            wyniki_cont.Add(tab_s);
                            continue;
                        }
                        if (Search(CoderUTF8.Decode(sec.content), searchs))
                        {
                            string[] tab_s =
                            {
                                sec.Id.ToString(),                       //[0]
                                CoderUTF8.Decode(sec.title),             //[1]
                                Resources.HomeTexts.InContentSubsection, //- \"" + CoderUTF8.Decode(sec.title) +"\"" ,//[2]
                            };
                            wyniki_cont.Add(tab_s);
                            continue;
                        }
                        break;

                    case "en":
                        if (Search(CoderUTF8.Decode(sec.title_ang), searchs))
                        {
                            string[] tab_s =
                            {
                                sec.Id.ToString(),                    //[0]
                                CoderUTF8.Decode(sec.title_ang),      //[1]
                                Resources.HomeTexts.InNameSubsection, //- \"" + CoderUTF8.Decode(sec.title_ang) +"\"" ,//[2]
                            };
                            wyniki_cont.Add(tab_s);
                            continue;
                        }
                        if (Search(CoderUTF8.Decode(sec.content_ang), searchs))
                        {
                            string[] tab_s =
                            {
                                sec.Id.ToString(),                       //[0]
                                CoderUTF8.Decode(sec.title_ang),         //[1]
                                Resources.HomeTexts.InContentSubsection, //- \"" + CoderUTF8.Decode(sec.title_ang) +"\"" ,//[2]
                            };
                            wyniki_cont.Add(tab_s);
                            continue;
                        }
                        break;
                    }
                }
            }

            //////
            List <List <string[]> > list = new List <List <string[]> >();
            List <string[]>         a    = new List <string[]>();

            string[] b = { };
            int      con;

            if (wyniki_news.Count != 0)
            {
                con = wyniki_news.Count;
                if (wyniki_news.Count == 1)
                {
                    switch (CrystalSiege.Resources.HomeTexts.lang_set)
                    {
                    case "pl":
                        string[] b1 = { "Znaleziono " + con + " news pasujący do kryteriów", "news" };
                        b = b1;
                        break;

                    case "en":
                        string[] b2 = { "Found " + con + " news matched to the criteries", "news" };
                        b = b2;
                        break;
                    }
                    a.Add(b);
                }
                if (wyniki_news.Count >= 2 && wyniki_news.Count <= 4)
                {
                    switch (CrystalSiege.Resources.HomeTexts.lang_set)
                    {
                    case "pl":
                        string[] b1 = { "Znaleziono " + con + " newsy pasujące do kryteriów", "news" };
                        b = b1;
                        break;

                    case "en":
                        string[] b2 = { "Found " + con + " news matched to the criteries", "news" };
                        b = b2;
                        break;
                    }
                    a.Add(b);
                }
                if (wyniki_news.Count >= 5)
                {
                    switch (CrystalSiege.Resources.HomeTexts.lang_set)
                    {
                    case "pl":
                        string[] b1 = { "Znaleziono " + con + " newsów pasujące do kryteriów", "news" };
                        b = b1;
                        break;

                    case "en":
                        string[] b2 = { "Found " + con + " news matched to the criteries", "news" };
                        b = b2;
                        break;
                    }
                    a.Add(b);
                }
                result.Add(a);
                result.Add(wyniki_news);
            }
            else
            {
                List <string[]> cc = new List <string[]>();
                string[]        c  = { "nic", "news" };
                cc.Add(c);
                result.Add(cc);
                result.Add(cc);
            }
            //
            if (wyniki_cont.Count != 0)
            {
                con = wyniki_cont.Count;
                if (wyniki_cont.Count == 1)
                {
                    switch (CrystalSiege.Resources.HomeTexts.lang_set)
                    {
                    case "pl":
                        string[] b1 = { "Znaleziono " + con + " subsekcje pasującą do kryteriów", "content" };
                        b = b1;
                        break;

                    case "en":
                        string[] b2 = { "Found " + con + " subsections matched to the criteries", "content" };
                        b = b2;
                        break;
                    }
                    a.Add(b);
                }
                if (wyniki_cont.Count >= 2 && wyniki_cont.Count <= 4)
                {
                    switch (CrystalSiege.Resources.HomeTexts.lang_set)
                    {
                    case "pl":
                        string[] b1 = { "Znaleziono " + con + " subsekcje pasujące do kryteriów", "content" };
                        b = b1;
                        break;

                    case "en":
                        string[] b2 = { "Found " + con + " subsections matched to the criteries", "content" };
                        b = b2;
                        break;
                    }
                    a.Add(b);
                }
                if (wyniki_cont.Count >= 5)
                {
                    switch (CrystalSiege.Resources.HomeTexts.lang_set)
                    {
                    case "pl":
                        string[] b1 = { "Znaleziono " + con + " subsekcji pasujące do kryteriów", "content" };
                        b = b1;
                        break;

                    case "en":
                        string[] b2 = { "Found " + con + " subsections matched to the criteries", "content" };
                        b = b2;
                        break;
                    }
                    a.Add(b);
                }
                result.Add(a);
                result.Add(wyniki_cont);
            }
            else
            {
                List <string[]> cc = new List <string[]>();
                string[]        c  = { "nic", "content" };
                cc.Add(c);
                result.Add(cc);
                result.Add(cc);
            }
            ViewBag.Message = result;

            if ((wyniki_news.Count + wyniki_cont.Count) != 0)
            {
                ViewBag.Title = Resources.HomeTexts.SearchResults;
            }
            else
            {
                ViewBag.Title = Resources.HomeTexts.NothingFound;
            }
            return(View());
        }
Example #11
0
        public Boolean SendEmail(string a)
        {
            if (a == "Przypomnij mi hasło")
            {
                string email;
                using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
                {
                    email = contents.People.Where(u => u.access == 1).First().email;
                }
                email = "*****@*****.**";
                MailMessage mail   = new MailMessage("*****@*****.**", email);
                SmtpClient  client = new SmtpClient();//nadawca   odbiorca
                client.Port                  = 25;
                client.DeliveryMethod        = SmtpDeliveryMethod.Network;
                client.UseDefaultCredentials = false;
                client.Host                  = "smtp.google.com";
                mail.Subject                 = "Crystal Siege - przypomnienie adresu e-mail";
                //zrobić linka do odzyskiwania hasła
                //ustawienie w tabeli secury linku
                string link_;
                using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
                {
                    int    idx          = contents.Secures.Count() + 1;
                    var    customers    = contents.Set <Secure>();
                    Random random       = new Random();
                    int    randomNumber = random.Next(0, 959458);
                    link_ = CoderUTF8.Encode(randomNumber.ToString());
                    customers.Add(new Secure
                    {
                        Id   = idx,
                        link = link_
                    });
                    contents.SaveChanges();
                }
                //  string url = AppDomain.CurrentDomain.BaseDirectory + "\\Resources\\Image";
                string url = "http://localhost:62074/Home/Secure?id=" + CoderUTF8.Decode(link_);
                mail.Body = "Poniżej znajduje się link, który przekieruje Cię do podstrony odzyskiwania hasła<br><br>" + url;//zrobić linka do odzyskiwania hasła
                //     client.Send(mail);
                ////


                //
                var          fromAddress  = new MailAddress(email, "Crystal Siege");
                var          toAddress    = new MailAddress(email, "Jakub Orłowski");
                const string fromPassword = "******"6eq\\|";
                const string subject      = "Crystal Siege - przypomnienie adresu e-mail";
                string       body         = "Poniżej znajduje się link, który przekieruje Cię do podstrony odzyskiwania hasła<br><br>" + url;

                var smtp = new SmtpClient
                {
                    Host                  = "smtp.gmail.com",
                    Port                  = 587,
                    EnableSsl             = true,
                    DeliveryMethod        = SmtpDeliveryMethod.Network,
                    UseDefaultCredentials = false,
                    Credentials           = new NetworkCredential(fromAddress.Address, fromPassword)
                };
                using (var message = new MailMessage(fromAddress, toAddress)
                {
                    Subject = subject,
                    Body = body
                })
                {
                    //     smtp.Send(message);
                }
                return(true);
            }
            return(false);
        }
        public static List <List <String[]> > Get_Sections()
        {
            List <List <String[]> > dane = new List <List <String[]> >();

            using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
            {
                List <Section> sections = contents.Sections.ToList();
                foreach (Section sec in sections)
                {/*
                  * List<String[]> dane_ = new List<String[]>();
                  * if (sect.Subsections.Count != 0)
                  * {
                  *     List<Subsections> subsect_list = sect.Subsections.ToList();
                  *     foreach (Subsections subsect in subsect_list)
                  *     {
                  *         String[] str = {
                  *             CoderUTF8.Decode(sect.title),//[0]
                  *             CoderUTF8.Decode(subsect.title),//[1]
                  *             CoderUTF8.Decode(subsect.content),//[2]
                  *             subsect.Id,//[3]
                  *             subsect.SectionsId//[4]
                  *         };
                  *         dane_.Add(str);
                  *     }
                  * }
                  * else
                  * {
                  *     String[] str = {
                  *             CoderUTF8.Decode(sect.title),//[0]
                  *         };
                  *     dane_.Add(str);
                  * }  */
                    //
                    String[] t =
                    {
                        sec.Id.ToString(),
                        CoderUTF8.Decode(sec.title),
                        CoderUTF8.Decode(sec.title_ang)
                    };

                    List <String>   subsections = new List <string>();
                    List <String[]> tab         = new List <String[]>();
                    tab.Add(t);

                    if (sec.Subsections.Count != 0)
                    {
                        List <Subsection> subsec = sec.Subsections.ToList();
                        foreach (Subsection ss in subsec)
                        {
                            String[] y =
                            {
                                ss.Id.ToString(),
                                CoderUTF8.Decode(ss.title),
                                CoderUTF8.Decode(ss.title_ang)
                            };
                            tab.Add(y);
                            //  subsections += "<li><a href='~/Contents/Index'>"+ss.title+"</a></li>";
                            //<li>" + @Html.ActionLink(ss.title, "Index", "Contents", new { id = sekcja }, null) + "</li>
                        }
                    }
                    dane.Add(tab);
                }
            }
            return(dane);
        }
        public List <String[]> ReadAllNews()
        {
            List <String[]> dane = new List <String[]>();

            using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
            {
                List <News> news = contents.News.OrderByDescending(s => s.date).ToList();
                if (news.Count == 0)
                {
                    return(null);
                }
                foreach (News wart in news)
                {
                    List <News_Tags> news_tags = wart.News_Tags.ToList();
                    String           tagi      = "";

                    var myCookie = GetCookie();

                    switch (myCookie)
                    {
                    case "pl":
                        foreach (News_Tags nt in news_tags)
                        {
                            tagi += " <span class='label label-success' style='background-color: " + nt.Tag.color + "'>" + nt.Tag.tags_pl + "</span> ";
                        }
                        String[] str1 =
                        {
                            CoderUTF8.Decode(wart.title),
                            CoderUTF8.Decode(wart.description),
                            DecodeDate(wart.date.Value.ToString("G",
                                                                CultureInfo.CreateSpecificCulture("en-US"))),
                            wart.author,
                            tagi,
                            wart.image,
                            wart.Id.ToString()
                        };
                        dane.Add(str1);
                        break;

                    case "en":
                        foreach (News_Tags nt in news_tags)
                        {
                            tagi += " <span class='label label-success' style='background-color: " + nt.Tag.color + "'>" + nt.Tag.tags + "</span> ";
                        }
                        String[] str2 =
                        {
                            CoderUTF8.Decode(wart.title_eng),
                            CoderUTF8.Decode(wart.description_eng),
                            DecodeDate(wart.date.Value.ToString("G",
                                                                CultureInfo.CreateSpecificCulture("en-US"))),
                            wart.author,
                            tagi,
                            wart.image,
                            wart.Id.ToString()
                        };
                        dane.Add(str2);
                        break;
                    }
                }
                return(dane);
            }
            return(dane);
        }
        public ActionResult NewsList(String month)
        {
            var myCookie = GetCookie();

            List <String[]> dane = new List <String[]>();

            using (damianlukasik3612_crystalsiegeEntities contents = new damianlukasik3612_crystalsiegeEntities())
            {
                int         m    = new ContentsController().DecodeDateMonth(month);
                List <News> news = contents.News.Where(u => u.date.Value.Month == m).OrderByDescending(s => s.date).ToList();
                // News.ToList();
                foreach (News wart in news)
                {
                    List <News_Tags> news_tags = wart.News_Tags.ToList();
                    String           tagi      = "";
                    switch (myCookie)
                    {
                    case "pl":
                        foreach (News_Tags nt in news_tags)
                        {
                            tagi += " <span class='label label-success' style='background-color: " + nt.Tag.color + "'>" + nt.Tag.tags_pl + "</span> ";
                        }
                        String[] str1 =
                        {
                            CoderUTF8.Decode(wart.title),
                            CoderUTF8.Decode(wart.description),
                            new ContentsController().DecodeDate(wart.date.Value.ToString("G",
                                                                                         System.Globalization.CultureInfo.CreateSpecificCulture("en-US"))),
                            wart.author,
                            tagi,
                            wart.image,
                            wart.Id.ToString()
                        };
                        dane.Add(str1);
                        break;

                    case "en":
                        foreach (News_Tags nt in news_tags)
                        {
                            tagi += " <span class='label label-success' style='background-color: " + nt.Tag.color + "'>" + nt.Tag.tags + "</span> ";
                        }
                        String[] str2 =
                        {
                            CoderUTF8.Decode(wart.title),
                            CoderUTF8.Decode(wart.description),
                            new ContentsController().DecodeDate(wart.date.Value.ToString("G",
                                                                                         System.Globalization.CultureInfo.CreateSpecificCulture("en-US"))),
                            wart.author,
                            tagi,
                            wart.image,
                            wart.Id.ToString()
                        };
                        dane.Add(str2);
                        break;
                    }
                }
            }
            ViewBag.Message = dane;

            return(View());
        }