Esempio n. 1
0
        public ActionResult EditPetition(_EditPetitionViewModel model)
        {
            if (!Request.IsAuthenticated)
            {
                throw new AuthenticationException();
            }

            if (ModelState.IsValid)
            {
                PetitionContainer data = new PetitionContainer
                {
                    GroupId   = model.GroupId,
                    Id        = model.Id,
                    IsPrivate = model.IsPrivate,
                    Tags      = model.TagTitles,
                    Text      = model.Text,
                    Title     = model.Title
                };

                Petition petition = VotingService.EditPetition(data, UserContext.Current.Id);

                return(RedirectToAction("petition", petition.Controller, new { id = petition.Id }));
            }

            if (model.GroupId != null)
            {
                View("../group/editpetition", model);
            }

            return(View("../user/editpetition", model));
        }