public ActionResult ManageJournalists(ManageJournalistsViewModel vm, int newspaperID)
        {
            var newspaper = newspaperRepository.GetById(newspaperID);

            if (newspaper == null)
            {
                return(NewspaperDoesNotExistRedirect());
            }

            var entity = SessionHelper.CurrentEntity;
            var rights = newspaperService.GetNewspaperRights(newspaper, entity, SessionHelper.LoggedCitizen);

            if (rights.HasFlag(NewspaperRightsEnum.CanManageJournalists) == false)
            {
                return(RedirectToHomeWithError("You cannot manage journalists!"));
            }

            if (ModelState.IsValid)
            {
                var journalistsRights = new Dictionary <int, NewspaperRightsEnum>();
                foreach (var journalist in vm.Journalists)
                {
                    var journalistRights = journalist.GetRights();
                    journalistsRights.Add(journalist.CitizenID, journalistRights);
                }

                newspaperService.ChangeRights(new ChangeJournalistsRightsParam(newspaper, journalistsRights));
                AddSuccess("Rights were changed!");
            }

            vm = new ManageJournalistsViewModel(newspaper, newspaperService);
            return(View(vm));
        }
        public ActionResult ManageJournalists(int newspaperID)
        {
            var newspaper = newspaperRepository.GetById(newspaperID);

            if (newspaper == null)
            {
                return(NewspaperDoesNotExistRedirect());
            }

            var entity = SessionHelper.CurrentEntity;
            var rights = newspaperService.GetNewspaperRights(newspaper, entity, SessionHelper.LoggedCitizen);

            if (rights.HasFlag(NewspaperRightsEnum.CanManageJournalists) == false)
            {
                return(RedirectToHomeWithError("You cannot manage journalists!"));
            }

            var vm = new ManageJournalistsViewModel(newspaper, newspaperService);

            return(View(vm));
        }