public PartialViewResult List(int?page) { var items = NewsCategoryRepository.GetAll().Select(x => x.ToDataViewModel()).ToList(); var pageNumber = page ?? 1; return(PartialView(items.ToPagedList(pageNumber, TechOfficeConfig.PAGESIZE))); }
public async Task <JsonResult> Create(BaseDataViewModel model) { return(await ExecuteWithErrorHandling(async() => { var result = model.ToDataResult <NewsCategoryResult>().Update(u => { u.CreatedBy = UserName; }); return await ExecuteResultAsync(async() => await NewsCategoryRepository.AddAsync(result)); })); }
public async Task <JsonResult> DeleteConfirmed(int id) { return(await ExecuteWithErrorHandling(async() => { if (id == 0) { Response.StatusCode = (int)HttpStatusCode.BadRequest; return Json("Bad Request", JsonRequestBehavior.AllowGet); } return await ExecuteResultAsync(async() => await NewsCategoryRepository.DeleteByAsync(id)); })); }
public async Task <JsonResult> Edit(int id, BaseDataViewModel model) { return(await ExecuteWithErrorHandling(async() => { var cv = model.ToDataResult <NewsCategoryResult>().Update(u => { u.Id = id; u.LastUpdatedBy = UserName; }); return await ExecuteResultAsync(async() => await NewsCategoryRepository.UpdateAsync(cv)); })); }
public UnitOfWork(ApplicationDbContext db, IOptions <AppSettings> appSettings) { _db = db; Menu = new MenuRepository(_db); MenuAdjustment = new MenuAdjustmentRepository(_db); Layout = new LayoutRepository(_db); HomePageBanner = new HomePageBannerRepository(_db); HomePage = new HomePageRepository(_db); Project = new ProjectRepository(_db); ProjectCategory = new ProjectCategoryRepository(_db); CultureLayout = new CultureLayoutRepository(_db); CultureSection = new CultureSectionRepository(_db); CulturePost = new CulturePostRepository(_db); CulturePicture = new CulturePictureRepository(_db); CultureAlbum = new CultureAlbumRepository(_db); News = new NewsRepository(_db); VisionMission = new VisionMissionRepository(_db); Partners = new PartnerRespository(_db); PartnerTypes = new PartnerTypeRespository(_db); Footer = new FooterRepository(_db); Menu = new MenuRepository(_db); SolutionContent = new SolutionContentRepository(_db); SolutionCategory = new SolutionCategoryRepository(_db); SolutionPicture = new SolutionPictureRepository(_db); RecruitmentBanner = new RecruitmentBannerRepository(_db); RecruitmentCareers = new RecruitmentCareersRepository(_db); RecruitmentJob = new RecruitmentJobRepository(_db); VisionMission = new VisionMissionRepository(_db); Footer = new FooterRepository(_db); FooterAdjustment = new FooterAdjustmentRepository(_db); AppUser = new AppUserRepository(_db, appSettings); NewsCategory = new NewsCategoryRepository(_db); ColorPage = new ColorPageRepository(_db); }
public NewsCategorieservices(PXHotelEntities entities) { _localizedResourceServices = HostContainer.GetInstance<ILocalizedResourceServices>(); _newsCategoryRepository = new NewsCategoryRepository(entities); }
private List <News> GetNews() { NewsCategoryRepository _categoryRepository = new NewsCategoryRepository(); NewsCategory category1 = _categoryRepository.GetNewsCategory((short)NewsCategoryType.Political); NewsCategory category2 = _categoryRepository.GetNewsCategory((short)NewsCategoryType.Sports); NewsCategory category3 = _categoryRepository.GetNewsCategory((short)NewsCategoryType.Travel); NewsCategory category4 = _categoryRepository.GetNewsCategory((short)NewsCategoryType.Entertainment); List <News> news = new List <News>() { new News { NewsId = Guid.NewGuid(), Category = category1, Title = "Headline 1", Content = "Content 1", PublishedDate = DateTime.UtcNow, ReportedDate = DateTime.UtcNow, UpdatedDate = null, Reporter = new NewsReporter { ReportedId = 1, FirstName = "fName", LastName = "lName" } }, new News { NewsId = Guid.NewGuid(), Category = category2, Title = "Headline 2", Content = "Content 2", PublishedDate = DateTime.UtcNow, ReportedDate = DateTime.UtcNow, UpdatedDate = null, Reporter = new NewsReporter { ReportedId = 2, FirstName = "fName", LastName = "lName" } }, new News { NewsId = Guid.NewGuid(), Category = category3, Title = "Headline 3", Content = "Content 3", PublishedDate = DateTime.UtcNow, ReportedDate = DateTime.UtcNow, UpdatedDate = null, Reporter = new NewsReporter { ReportedId = 1, FirstName = "fName", LastName = "lName" } }, new News { NewsId = Guid.NewGuid(), Category = category4, Title = "Headline 4", Content = "Content 4", PublishedDate = DateTime.UtcNow, ReportedDate = DateTime.UtcNow, UpdatedDate = null, Reporter = new NewsReporter { ReportedId = 3, FirstName = "fName", LastName = "lName" } }, new News { NewsId = Guid.NewGuid(), Category = category1, Title = "Headline 5", Content = "Content 5", PublishedDate = DateTime.UtcNow, ReportedDate = DateTime.UtcNow, UpdatedDate = null, Reporter = new NewsReporter { ReportedId = 1, FirstName = "fName", LastName = "lName" } }, new News { NewsId = Guid.NewGuid(), Category = category1, Title = "Headline 6", Content = "Content 6", PublishedDate = DateTime.UtcNow, ReportedDate = DateTime.UtcNow, UpdatedDate = null, Reporter = new NewsReporter { ReportedId = 1, FirstName = "fName", LastName = "lName" } }, new News { NewsId = Guid.NewGuid(), Category = category1, Title = "Headline 7", Content = "Content 7", PublishedDate = DateTime.UtcNow, ReportedDate = DateTime.UtcNow, UpdatedDate = null, Reporter = new NewsReporter { ReportedId = 1, FirstName = "fName", LastName = "lName" } }, new News { NewsId = Guid.NewGuid(), Category = category1, Title = "Headline 8", Content = "Content 8", PublishedDate = DateTime.UtcNow, ReportedDate = DateTime.UtcNow, UpdatedDate = null, Reporter = new NewsReporter { ReportedId = 4, FirstName = "fName", LastName = "lName" } }, new News { NewsId = Guid.NewGuid(), Category = category1, Title = "Headline 9", Content = "Content 9", PublishedDate = DateTime.UtcNow, ReportedDate = DateTime.UtcNow, UpdatedDate = null, Reporter = new NewsReporter { ReportedId = 5, FirstName = "fName", LastName = "lName" } }, new News { NewsId = Guid.NewGuid(), Category = category4, Title = "Headline 10", Content = "Content 10", PublishedDate = DateTime.UtcNow, ReportedDate = DateTime.UtcNow, UpdatedDate = null, Reporter = new NewsReporter { ReportedId = 1, FirstName = "fName", LastName = "lName" } } }; return(news); }
public PartialViewResult Edit(int id) { var data = NewsCategoryRepository.Single(id).ToDataViewModel(); return(PartialView("_PartialPageBaseDataEdit", data)); }
public NewsCategorieservices(PXHotelEntities entities) { _localizedResourceServices = HostContainer.GetInstance <ILocalizedResourceServices>(); _newsCategoryRepository = new NewsCategoryRepository(entities); }