Example #1
0
        public ActionResult Create(UserSearchCreate value)
        {
            if (value == null)
            {
                throw new ArgumentNullException("value");
            }

            var search = this.UserSearchService.Create();
            var privilege = new UserSearchPrivilege();

            if (!privilege.CanCreate(search))
            {
                return NotAuthorized();
            }

            value.Validate();

            if (value.IsValid)
            {
                value.ValueToModel(search);

                this.UserSearchService.Insert(search);

                return base.RedirectToRoute(UsersAdministrationRoutes.SearchIndex, new { id = search.Id });
            }

            value.CopyToModel(ModelState);

            var searches = this.UserSearchService.GetAll(new UserSearchUserSpecification(base.Identity.Id));

            value.Initialize(searches);

            return base.View(Views.Create, value);
        }
Example #2
0
        public ActionResult Create()
        {
            var search = this.UserSearchService.Create();
            var privilege = new UserSearchPrivilege();

            if (!privilege.CanCreate(search))
            {
                return NotAuthorized();
            }

            var searches = this.UserSearchService.GetAll(new UserSearchUserSpecification(base.Identity.Id));
            var value = new UserSearchCreate();

            value.Initialize(searches);

            return base.View(Views.Create, value);
        }