示例#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));
        }