public IndexModel(ILogger <IndexModel> logger, IPagesService pagesService, IArticlesService articlesService, ISiteConfigurationRepository configRepository) { _logger = logger; _pagesService = pagesService; _articlesService = articlesService; _configRepository = configRepository; }
public CommentsController(IMapper mapper, IArticlesService articlesService, ILog logger) : base(logger) { _mapper = mapper; _articlesService = articlesService; _logger = logger; }
public HomeController( IArticlesService articleService, IUsersService usersService) { this.articleService = articleService; this.usersService = usersService; }
public ActionResult EditArt(int id) { IArticlesService artSrv = IoC.Resolve <IArticlesService>(); var model = artSrv.Getbykey(id); return(View(model)); }
public ActionResult ViewAttachment(int id) { IArticlesService artSrv = IoC.Resolve <IArticlesService>(); Articles model = artSrv.Getbykey(id); byte[] data = model.AttachData; if (data != null) { string typeData = model.TypeData; string contentType = ""; if (typeData.Equals(".pdf")) { contentType = "application/pdf"; } if (typeData.Equals(".doc")) { contentType = "application/msword"; } if (typeData.Equals(".docx")) { contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; } return(File(data, contentType)); } else { return(Redirect("/Article/ApproveIndex")); } }
public ArticlesController( IArticlesService articlesService, ICurrentUserService currentUser) { this.articlesService = articlesService; this.currentUser = currentUser; }
public ArticlesController( IArticlesService articlesService, UserManager <ElectricTravelUser> userManager) { this.articlesService = articlesService; this.userManager = userManager; }
public ArticleController(IArticlesService article, ILogsService logs, IHttpContextAccessor httpContext, IMemoryCache memcache) { _article = article; _logs = logs; _httpContext = httpContext; _memcache = memcache; }
public HomeController( IArticlesService articleService, UserManager <ApplicationUser> userManager) { this.articleService = articleService; this.userManager = userManager; }
private bool ProcessProductsFile(IServiceProvider serviceProvider, string fileName, string fileContent) { // Загружаем справочник стран AppDbContext db = serviceProvider.GetService <AppDbContext>(); var countries = db.Countries.ToList(); Dictionary <string, string> countryNameLookup = new Dictionary <string, string>(); foreach (var country in countries) { countryNameLookup[country.Key] = country.Name; } // Загружаем текущий список продуктов из базы IArticlesService articlesService = serviceProvider.GetService <IArticlesService>(); IEnumerable <ArticleDto> currentProducts = articlesService.Search(new SearchFormDto { Take = int.MaxValue }).Items; // Получаем список продуктов из файла, обновляем имеющиеся продукты bool hasErrors; IEnumerable <ArticleDto> products = LoadProductsFromFile(fileName, fileContent, currentProducts, countryNameLookup, out hasErrors); if (!hasErrors) { // Сохраняем изменения в базу articlesService.Import(products); } return(!hasErrors); }
public List <ListArticle> AjaxQuery(ArticlesRequest request) { var data = new List <ListArticle>(); var query = IArticlesService.Query(request); if (query != null) { var roles = _securityHelper.GetCurrentUser().CurrentUser.Roles.ToList(); data = query.ModelList.Select(x => new ListArticle(x)).ToList(); foreach (var item in data) { if (roles[0].IsSuper || roles[0].Permissions.Contains("EditArticles")) { item.boor += "<a href='#' onclick=OperatorThis('Edit','/Articles/Edit/" + item.articleId + "') class='tablelink'>编辑 </a> "; } if (roles[0].IsSuper || roles[0].Permissions.Contains("DeleteArticles")) { item.boor += "<a href='#' onclick=OperatorThis('Delete','/Articles/Delete/" + item.articleId + "') class='tablelink'>删除 </a> "; } } pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, query.TotalCount); } else { pageHtml = MvcPage.AjaxPager((int)request.PageIndex, (int)request.PageSize, 0); } return(data); }
public ActionResult Index(ArticleIndexModel model, int?page, bool isEn = false) { int defautPagesize = 10; int total = 0; int currentPageIndex = page.HasValue ? page.Value - 1 : 0; IArticlesService artSrv = IoC.Resolve <IArticlesService>(); ICategoryService categorySrv = IoC.Resolve <ICategoryService>(); string kw = String.IsNullOrWhiteSpace(model.Keyword) ? null : model.Keyword.Trim(); if (string.IsNullOrEmpty(model.CatID)) { model.CatID = "0"; } int cID = int.Parse(model.CatID); var list = artSrv.GetBySearch(HttpContext.User.Identity.Name, kw, cID, currentPageIndex, defautPagesize, out total); model.Categories = categorySrv.Query.Where(p => p.Active).OrderBy(p => p.NameVNI).ToList(); model.Articles = new PagedList <Articles>(list, currentPageIndex, defautPagesize, total); if (isEn) { return(View("Indexen", model)); } return(View(model)); }
public HomeController( IArticlesService articles, ICategoriesService categories) { this.articles = articles; this.categories = categories; }
public ManageCategoriesController(IMapper mapper, IArticlesService articlesService, ILog logger) : base(logger) { _mapper = mapper; _articlesService = articlesService; _logger = logger; }
public ActionResult Delete(int id) { try { ICategoryService cateSrv = IoC.Resolve <ICategoryService>(); IArticlesService artSrv = IoC.Resolve <IArticlesService>(); int c = artSrv.Query.Where(p => p.CategoryID == id).Count(); if (c > 0) { Messages.AddErrorFlashMessage("Không được xóa chuyên mục đang sử dụng."); logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Category - Xóa :" + id, "Không được xóa chuyên mục đang sử dụng", LogType.Error, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); return(RedirectToAction("Index")); } Category cate = cateSrv.Getbykey(id); cateSrv.Delete(cate); cateSrv.CommitChanges(); Messages.AddFlashMessage("Xóa thành công."); logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Category - Delete :" + id, "Edit Category Success", LogType.Success, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); } catch (Exception ex) { logSrv.CreateNew(FXContext.Current.CurrentUser.userid, "Category - Delete :" + id, "Delete Category Error: " + ex, LogType.Error, HttpContext.Request.UserHostAddress, HttpContext.Request.Browser.Browser); Messages.AddErrorFlashMessage("Chưa xóa được, vui lòng thực hiện lại."); } return(RedirectToAction("Index")); }
public FormListDocument(IWarehouseDocumentsService documentsService, IArticlesService articlesService) { _documentsService = documentsService; _articlesService = articlesService; InitializeComponent(); RefreshDataGridView(); }
public void TestsSetup() { AutoMapperConfig.RegisterMappings(); this.articles = ServicesObjectFactory.GetArticlesService(); this.controller = new ArticlesController(this.articles); this.controller.Cache = new HttpCacheService(); }
public ArticlesStatisticsController(IArticlesService articlesService , IStatisticsService statisticsService , IArticlesStatisticsService articlesStatisticsService) { this.articlesService = articlesService; this.statisticsService = statisticsService; this.articlesStatisticsService = articlesStatisticsService; }
public HomeControllerTest() { ConfigureMappings(); this._productsService = new ProductsService(); this._reviewsService = new ReviewsService(); this._articlesService = new ArticlesService(); this._controller = new HomeController(this._productsService, this._reviewsService, this._articlesService); }
public HomeController(IArticlesService articlesService, ILocationsService locationsService, IUsersService usersService) { this.articlesService = articlesService; this.locationsService = locationsService; this.usersService = usersService; }
public ActionResult ArticlesSearch(string searchText) { IArticlesService artSrv = IoC.Resolve <IArticlesService>(); int total = 0; var v = artSrv.GetbyFilter(searchText, 0, 10, out total).Select(c => new { c.NameVNI, c.NameENG, Url = URLManager.GetURL(c) }).ToList(); return(Json(v, JsonRequestBehavior.AllowGet)); }
public GetLocalLatestViewComponent( IArticlesService articleService, UserManager <ApplicationUser> userManager, IAddressesService addressesService) { this.articleService = articleService; this.userManager = userManager; this.addressesService = addressesService; }
public ActionResult Approve(int id) { IArticlesService artSrv = IoC.Resolve <IArticlesService>(); Articles model = artSrv.Getbykey(id); model.Active = true; Messages.AddFlashMessage("Tin đã được chỉnh sửa thành công."); return(View(model)); }
public ArticlesController( IArticlesService articlesService, IWebHostEnvironment webHostEnvironment, IUsersService usersService) { this.articlesService = articlesService; this.webHostEnvironment = webHostEnvironment; this.usersService = usersService; }
public FormAddArticle(ArticleViewModel article, IArticlesService articlesService) : this() { _articlesService = articlesService; _article = article; textBoxName.DataBindings.Add(nameof(textBoxName.Text), article, nameof(ArticleViewModel.Name), false, DataSourceUpdateMode.OnPropertyChanged); numericNetPrice.DataBindings.Add(nameof(numericNetPrice.Value), article, nameof(ArticleViewModel.NetPrice), false, DataSourceUpdateMode.OnPropertyChanged); numericCount.DataBindings.Add(nameof(numericNetPrice.Value), article, nameof(ArticleViewModel.Count), false, DataSourceUpdateMode.OnPropertyChanged); labelGrossPrice.DataBindings.Add(nameof(labelGrossPrice.Text), article, nameof(ArticleViewModel.GrossPrice), false, DataSourceUpdateMode.OnPropertyChanged); }
public VotesController( ApplicationDbContext dbContext, UserManager <ApplicationUser> userManager, IArticlesService articlesService) { this.dbContext = dbContext; this.userManager = userManager; this.articlesService = articlesService; }
public BlogController( IArticlesService articlesService, IBlogCategoriesService categoriesService, UserManager <ApplicationUser> userManager) { this.articlesService = articlesService; this.categoriesService = categoriesService; this.userManager = userManager; }
public void TestsSetup() { AutoMapperConfig.RegisterMappings(); this.recipesServiceMock = ServicesObjectFactory.GetRecipeService(); this.imagesServiceMock = ServicesObjectFactory.GetRecipeImagesService(); this.articlesServiceMock = ServicesObjectFactory.GetArticlesService(); this.controller = new HomeController(this.imagesServiceMock, this.recipesServiceMock, this.articlesServiceMock); }
public CategoriesController( ICategoriesService categoriesService, IArticlesService articlesService, IHttpContextAccessor http) { this.categoriesService = categoriesService; this.articlesService = articlesService; this.http = http; }
public HomeController( IPrivacyService privacyService, IArticlesService articlesService, IRecipesService recipesService) { this.privacyService = privacyService; this.articlesService = articlesService; this.recipesService = recipesService; }
public ArticlesController( IArticlesService articlesService, INewsFactory newsFactory, IMapper mapper) { _articlesService = articlesService; _newsFactory = newsFactory; _mapper = mapper; }
public SubCategoriesController( ISubCategoriesService subCategoriesService, IArticlesService articleService, IPagingService pagingService) { this.subCategoriesService = subCategoriesService; this.articleService = articleService; this.pagingService = pagingService; }
public DetailsViewModel(IArticlesService articles, IBookmarkService bookmarksService) { this.articles = articles; this.bookmarksService = bookmarksService; this.Bookmark = new RelayCommand(async () => { this.IsLoading = true; this.IsBookmarked = await this.bookmarksService.ToggleBookmarkAsync(this.Article.Id); this.IsLoading = false; }); }
public BaseController() { this.data = new UoWData(); this.itemsService = new ItemsService(this.data); this.articlesService = new ArticlesService(this.data); this.pagesService = new PagesService(this.data); LayoutModel model = new LayoutModel(); model.ItemCategories = this.itemsService.GetItemCategories(); model.Articles = this.articlesService.GetArticles().Take(5); model.Pages = this.pagesService.GetPages(); ViewBag.LayoutModel = model; }
public SetupFeedFilterViewModel(IArticlesService articlesService, IToastNotificator notificator, IUserSettings userSettings) { this.articlesService = articlesService; this.notificator = notificator; this.userSettings = userSettings; this.Title = "Filter erstellen"; var canExecute = this.WhenAny(vm => vm.CategorySelect.SelectedItem, vm => vm.DistrictSelect.SelectedItem, (ci, di) => ci.Value != null || di.Value != null); this.Create = ReactiveCommand.Create(canExecute); this.Create.Subscribe(this.CreateFilterAction); canExecute.Subscribe(b => { var titleParts = this.selectViewModels.OfType<SelectViewModel>() .Select(svm => (svm.SelectedItem as IdEntity)?.Name) .Where(p => p != null); this.FilterName = string.Join(" - ", titleParts); }); }
public VotesController(IArticlesService articles, IIdentifierProvider identifierProvider, IVotesService votes) { this.articles = articles; this.identifierProvider = identifierProvider; this.votes = votes; }
public AdminArticlesController(IArticlesService articles) { this.articles = articles; }
public LocalBookmarkService(IUserSettings userSettings, IArticlesService articlesService) { this.articlesService = articlesService; this.bookmarksSetting = userSettings.BookmarksSetting; }
public DesignController(IArticlesService articles) { this.articles = articles; }
public ArticleDetailsController(IArticlesService articles, IIdentifierProvider identifierProvider) { this.articles = articles; this.identifierProvider = identifierProvider; }
public void Setup() { this.articles = ObjectFactory.GetArticleService(); this._controller = new ArtController(this.articles); }
public Articles(IArticlesService articles) { this.articles = articles; }
public ArticleTabStripController(IArticlesService articles) { this.articles = articles; }
public HomeController(IEventsService events, IArticlesService articles) { this.events = events; this.articles = articles; }
public EditionsController(IEditionsService editionsService, IArticlesService articlesService) : base(editionsService, articlesService) { }
public EditorsController(ICategoriesService categories, IArticlesService articles) { this.categories = categories; this.articles = articles; }
public CommentsController(ICommentsService comments, IArticlesService articles) { this.comments = comments; this.articles = articles; }
public HomeController(IImagesService images, IRecipesService recipes, IArticlesService articles) { this.images = images; this.recipes = recipes; this.articles = articles; }
public HomeController(IArticlesService articles, ICoursesService courses, ISellingItemsService sellingItems) { this.articles = articles; this.courses = courses; this.sellingItems = sellingItems; }
public BookmarksViewModel(IBookmarkService bookmarkService, IArticlesService service) : base(service) { this.bookmarkService = bookmarkService; this.Title = "Ihre Leseliste"; }
public HomeController(IConfigService configService, IArticlesService articlesService) { _configService = configService; _articlesService = articlesService; }
public ArticlesController() { this.data = new UoWData(); this.articlesService = new ArticlesService(this.data); }
public ByCategoryController(ICategoriesService categories, IArticlesService articles) { this.articles = articles; }
public ArticlesController() { this.uoWData = new UoWData(); this.ArticlesService = new ArticlesService(this.uoWData); this.imagesService = new ImagesService(this.uoWData); }
public FilteredArticlesViewModel(IArticlesService articlesService) { this.articlesService = articlesService; this.ShowDetails = new RelayCommand<Article>(a => this.ShowViewModel<DetailsViewModel>(new Identifier(a.Id.ToString()))); this.Restock = new RelayCommand(this.RestockAction); }
public DistrictSettingViewModel(IArticlesService articlesService, IUserSettings userSettings) : base(articlesService) { this.setting = userSettings.DistrictSetting; }
public BaseCommonController(IEditionsService editionsService, IArticlesService articlesService) { this.editionsService = editionsService; this.articlesService = articlesService; }
public ArticlesController(IArticlesService articleService) { this.articleService = articleService; }
public SearchController(UserManager<User> userManager, IArticlesService articles, IEventsService events) { this.userManager = userManager; this.articles = articles; this.events = events; }