public ActionResult Create(UserSearchCreate value) { if (value == null) { throw new ArgumentNullException("value"); } var search = this.UserSearchService.Create(); value.Validate(); if (value.IsValid) { value.ValueToModel(search); this.UserSearchService.Insert(search); return RedirectToRoute(UsersRoutes.SearchIndex, new { id = search.Id }); } value.CopyToModel(ModelState); IList<UserSearch> searches = null; if (base.Identity.IsAuthenticated()) { searches = this.UserSearchService.GetAll(new UserSearchUserSpecification(base.Identity.Id)); } value.Initialize(searches); return View(Views.Create, value); }
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); }