Ejemplo n.º 1
0
 private static string GetMenuCats()
 {
     StringBuilder bld = new StringBuilder();
     using (ZloContext cn = new ZloContext()) {
         foreach (var cat in cn.Categorys.OrderBy(c => c.Por))
             bld.AppendLine(string.Format(tmplC, cat.Title, GetPostInCat(cat)));
     }
     return bld.ToString();
 }
Ejemplo n.º 2
0
 private static string GetMenuPosts()
 {
     StringBuilder bld = new StringBuilder();
     using (ZloContext cn = new ZloContext()) {
         IQueryable<Post> pst = cn.Posts.Where(p => p.CategoryId == null);
         foreach (var ps in pst)
             bld.AppendLine(string.Format(tmplP, ps.WebLink, ps.Title));
     }
     return bld.ToString();
 }
Ejemplo n.º 3
0
        public User ValidateUser(string userName, string password)
        {
            string hash = Hash.CreateHash(password);

            using (ZloContext cont = new ZloContext()) {
                return(cont.Users
                       .Where(u => u.Login == userName)
                       .Where(u => u.PassWord == hash).FirstOrDefault());
            }
        }
Ejemplo n.º 4
0
 private static string GetPostInCat(Category cat)
 {
     StringBuilder bld = new StringBuilder();
     using (ZloContext cn = new ZloContext()) {
         List<Post> psts = cn.Posts.Where(p => p.CategoryId == cat.Id).Where(p => p.InCatMenu).ToList();
         if (psts.Count > 0) {
             bld.AppendLine("<ul>");
             foreach (var ps in psts)
                 bld.AppendLine(string.Format(tmplP, ps.WebLink, ps.Title));
             bld.AppendLine("</ul>");
         }
     }
     return bld.ToString();
 }
Ejemplo n.º 5
0
 public User ValidateUser(string userName, string password)
 {
     string hash = Hash.CreateHash(password);
     using (ZloContext cont = new ZloContext()) {
         return cont.Users
             .Where(u => u.Login == userName)
             .Where(u => u.PassWord == hash).FirstOrDefault();
     }
 }