public static List<NewCategory> GetCategoryForHomepage(int length)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewCategoryRepository.GetAll().OrderByDescending(s => s.CreatedDate).Take(length).ToList();
     }
 }
 public static NewCategory Update(NewCategory item)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewCategoryRepository.Update(item);
     }
 }
 public static NewCategory GetByMeta(string meta)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewCategoryRepository.Find(s => s.MetaTittle == meta);
     }
 }
 public static NewCategory GetByName(string categoryName)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewCategoryRepository.Find(s => s.Name.Trim().ToLower().Contains(categoryName.Trim().ToLower()));
     }
 }
 public static List<NewCategory> GetAll()
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewCategoryRepository.GetAll().ToList();
     }
 }
 public static NewCategory GetById(long? id)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewCategoryRepository.Find(s => s.ID == id);
     }
 }
Beispiel #7
0
 public static News GetNewByMeta(string MetaTittle)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewRepository.Find(s => s.MetaTittle == MetaTittle);
     }
 }
Beispiel #8
0
 public static List<News> GetNewByCategry(long id)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewRepository.FindAll(s => s.CategoryID == id).ToList();
     }
 }
Beispiel #9
0
 public static News GetById(long newId)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewRepository.Find(s => s.ID == newId);
     }
 }
Beispiel #10
0
 public static IEnumerable<News> GetAllNew( int page, int pageSize)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewRepository.GetAll().OrderBy(x=>x.ID).ToPagedList(page,pageSize);
     }
 }
Beispiel #11
0
 public static bool Delete(News item)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewRepository.Delete(item);
     }
 }
Beispiel #12
0
 public static News Add(News item)
 {
     using (var uow = new UnitOfWork())
     {
         return uow.NewRepository.Add(item);
     }
 }
Beispiel #13
0
 public static User GetUser(string username, string password)
 {
     using (var uow = new UnitOfWork())
     {
         var user = uow.UserRepository.Find(s => s.UserName == username && s.Password == password);
         return user ?? null;
     }
 }
Beispiel #14
0
 public static User Login(string userName, string password)
 {
     using (var uow = new UnitOfWork())
     {
         var user = uow.UserRepository.Find(s => s.UserName.ToLower() == userName.ToLower() && s.Password == password);
         return user ?? null;
     }
 }
Beispiel #15
0
 public static List<News> ListNewRelated(long id)
 {
     using (var uow = new UnitOfWork())
     {
         var news = uow.NewRepository.Find(s => s.ID == id);
         return uow.NewRepository.FindAll(s => s.ID != id && s.CategoryID == news.CategoryID).ToList();
     }
 }