Beispiel #1
0
        public ActionResult GetMyEditors()
        {
            if (Request.Cookies["MagazineId"].Value == null)
            {
                SetMessage("Lo sentimos, ha ocurrido un error. Inténtelo de nuevo.", BootstrapAlertTypes.Danger); return(RedirectToAction("Index", "Magazines"));
            }
            int magId = Int32.Parse(Request.Cookies["MagazineId"].Value);

            var items = MagazineService.GetMyEditors(magId);

            List <EditorListViewModel> editors = new List <EditorListViewModel>();

            foreach (var item in items)
            {
                var addEditor = new EditorListViewModel
                {
                    UserId         = item.UserId,
                    UserName       = item.User.UserName,
                    Email          = item.User.Email,
                    GeneratedViews = MagazineService.GetCountsByUser(item.UserId)
                };

                editors.Add(addEditor);
            }

            return(View(editors));
        }
        public async Task <IViewComponentResult> InvokeAsync(EditorListViewModel model)
        {
            var stat = 10;

            var totalCount = await _context.TranslationDictionarys.Where(x => x.TranslationId == model.Id).CountAsync();

            var toTranslate = await _context.TranslationDictionarys.Where(x => x.TranslationId == model.Id && x.NewValue == null).CountAsync();

            var result = await _context.TranslationDictionarys.Where(x => x.TranslationId == model.Id)
                         .Include(a => a.Translations)
                         .Skip((model.PageIndex - 1) * stat).Take(stat).ToListAsync();

            var project = _context.Translations.Where(w => w.Id == model.Id).SingleOrDefault();

            ViewBag.hasDocument = project.HasDocument;
            ViewBag.trans       = model.Id;

            ViewBag.pageIndex = model.PageIndex;

            ViewBag.previous    = model.PageIndex == 1 ? false : true;
            ViewBag.next        = totalCount > model.PageIndex * stat ? true : false;
            ViewBag.toTranslate = toTranslate;

            return(View(result));
        }
        public IActionResult GetEditorListAsync([FromQuery] Guid id, int PageIndex)
        {
            var model = new EditorListViewModel()
            {
                Id = id, PageIndex = PageIndex
            };

            return(ViewComponent("WordsList", model));
        }