Пример #1
0
        public static PagedList<Log> GetPagedLog(string page)
        {
            int pageNumber = 1;

            if (!String.IsNullOrEmpty(page))
            {
                if (!int.TryParse(page, out pageNumber))
                {
                    pageNumber = 1;
                }
            }

            JGrimEntities1 db = new JGrimEntities1();
            return  (from log in db.Logs orderby log.LogDate descending select log).AsQueryable().ToPagedList<Log>(pageNumber, 20);
        }
Пример #2
0
        public PagedList<Photo> GetPagedPhotos(string page)
        {
            JGrimEntities1 db = new JGrimEntities1();

            int pageNumber=1;
            
            if (!String.IsNullOrEmpty(page))
            {
                if (!int.TryParse(page, out pageNumber))
                {
                    pageNumber = 1;
                }
            }

            return this.Photos.AsQueryable().ToPagedList<Photo>(pageNumber , 20);
        }
Пример #3
0
        public static bool LogError(string errorMessage)
        {
            JGrimEntities1 db = new JGrimEntities1();
            
            try
            {
                db.AddToLogs(new Log() { ErrorMessage = errorMessage, LogDate = DateTime.Now });

                db.SaveChanges(true);

                return true;
            }
            catch
            {
                return false;
            }
            finally{
                db.Dispose();
            }
        }
Пример #4
0
 public PagesController()
 {
     db = new JGrimEntities1();
 }
Пример #5
0
     public LogController() {
         db = new JGrimEntities1();
 }
Пример #6
0
 public PhotosController()
 {
     db = new JGrimEntities1();
 }
Пример #7
0
 public Upload()
 {
     db = new JGrimEntities1();
 }