public IActionResult DeleteEvent(int eventId) { var eventToDelete = _eventRepository.GetEventByEventId(eventId); _inviteRepository.DeleteInvite(eventId); _eventRepository.DeleteEvent(eventId); _movieRepository.DeleteMovie(eventToDelete.MovieId); return(Ok(eventToDelete)); }
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); }