コード例 #1
0
ファイル: EventController.cs プロジェクト: gseals/MovieFriend
        public IActionResult DeleteEvent(int eventId)
        {
            var eventToDelete = _eventRepository.GetEventByEventId(eventId);

            _inviteRepository.DeleteInvite(eventId);
            _eventRepository.DeleteEvent(eventId);
            _movieRepository.DeleteMovie(eventToDelete.MovieId);
            return(Ok(eventToDelete));
        }
コード例 #2
0
        public void TestDeleteUser()
        {
            var userRepo = new UserRepository(database);
            var usr      = userRepo.CreateNew(new User {
                DateCreated = DateTime.Now, Email = "*****@*****.**", Name = "Jaytee"
            });
            var invRepo = new InviteRepository(database, userRepo);
            var project = invRepo.CreateNew(new Project {
                CreatedByUserId = usr.Id, DateCreated = DateTime.Now, Description = "A demo api", Name = "DEMO API"
            });
            var ivc = invRepo.CreateInvite(new Invite {
                Email = "*****@*****.**", InvitedAt = DateTime.Now
            }, project.Id, usr.Id);

            Assert.NotNull(ivc);
            Assert.NotEmpty(ivc.Invites);

            invRepo.DeleteInvite(new Invite {
                Email = "*****@*****.**", InvitedAt = DateTime.Now
            }, project.Id, usr.Id);
            var vproject = invRepo.GetById(project.Id);

            Assert.NotEqual(ivc.Invites.Count, vproject.Invites.Count);
        }