예제 #1
0
        public ViewResult Edit(UserGroup userGroup, Sponsor sponsor)
        {
            if (!_securityContext.IsAdmin())
            {
                return NotAuthorizedView;
            }

            if (sponsor != null)
            {
                sponsor.UserGroup=userGroup;
            }

            return AutoMappedView<UpdateSponsorInput>(sponsor??new Sponsor(){UserGroup=userGroup});
        }
        public void Should_map_a_sponsor()
        {
            var userGroup = new UserGroup();
            var sponsor = new Sponsor
                          	{
                          		Name = "FooBar",
                                Level =SponsorLevel.Gold,
                                Url = "http://thisistheurl.com/",
                                                                UserGroup = userGroup
                          	};

            PersistEntities(userGroup);

            AssertObjectCanBePersisted(sponsor);
        }
		public void should_create_audit_info_on_save_and_update_child_entities()
		{
			ResetCurrentUser();
			User user1 = CurrentUser;
			user1.Username = "******";
			PersistEntities(user1);

			var group = new UserGroup();
			var sponsor = new Sponsor();
			group.Add(sponsor);
			PersistEntitiesWithAuditing(user1, new DateTime(2009, 4, 5), group, sponsor);
			var group1 = GetAuditedSession(user1, new DateTime(2009, 4, 5)).Load<UserGroup>(group.Id);
			group1.ChangeAuditInfo.Created.ShouldEqual(new DateTime(2009, 4, 5));
			group1.ChangeAuditInfo.CreatedBy.ShouldEqual(user1.Username);
			group1.ChangeAuditInfo.Updated.ShouldEqual(new DateTime(2009, 4, 5));
			group1.ChangeAuditInfo.UpdatedBy.ShouldEqual(user1.Username);
			Sponsor sponsor1 = group.GetSponsors()[0];
			sponsor1.ChangeAuditInfo.Created.ShouldEqual(new DateTime(2009, 4, 5));
			sponsor1.ChangeAuditInfo.CreatedBy.ShouldEqual(user1.Username);
			sponsor1.ChangeAuditInfo.Updated.ShouldEqual(new DateTime(2009, 4, 5));
			sponsor1.ChangeAuditInfo.UpdatedBy.ShouldEqual(user1.Username);
		}
예제 #4
0
		public virtual void Remove(Sponsor child)
		{
			_sponsors.Remove(child);
		}
예제 #5
0
		public virtual void Add(Sponsor child)
		{
			_sponsors.Add(child);
		}
예제 #6
0
 public virtual void Remove(Sponsor child)
 {
     _sponsors.Remove(child);
 }
예제 #7
0
 public virtual void Add(Sponsor child)
 {
     _sponsors.Add(child);
 }
예제 #8
0
 public ActionResult Delete(UserGroup userGroup, Sponsor sponsor)
 {
     userGroup.Remove(sponsor);
     _repository.Save(userGroup);
     return RedirectToAction<SponsorController>(c => c.Index(null));
 }