public void Test_UserSearchCreate_Initialize() { var value = new UserSearchCreate(); value.Initialize(new List<UserSearch>()); Assert.IsNotNull(value.Searches, "Searches"); }
public ActionResult Create() { var value = new UserSearchCreate(); 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() { 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); }
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); }