public void RemoveTicketCallsRepositoryDeleteTicketWithTheSameTicketNumber()
        {
            _repository = Substitute.For <ITicketRepository>();
            _mgr        = new TicketManager(_repository);

            _mgr.RemoveTicket(5);
            _repository.Received(1).DeleteTicket(5);
        }
        public ActionResult Delete(int id, FormCollection collection)
        {
            try {
                mgr.RemoveTicket(id);

                return(RedirectToAction("Index"));
            }
            catch {
                return(View());
            }
        }
Example #3
0
        public IHttpActionResult Delete(int id)
        {
            Ticket ticketToDelete = mgr.GetTicket(id);

            if (ticketToDelete == null)
            {
                return(NotFound());
            }

            mgr.RemoveTicket(id);
            return(StatusCode(HttpStatusCode.NoContent));
        }
Example #4
0
        static void Main(string[] args)
        {
            PrintAllTickets();

            mgr.RemoveTicket(1);
            Ticket t = mgr.GetTicket(1);

            if (t != null)
            {
                Console.WriteLine("Ticket {0} has not been removed!");
            }

            Console.WriteLine("Ticket has been removed!\n");

            PrintAllTickets();
            Console.ReadLine();
        }
 public IActionResult DeleteConfirmed(int id)
 {
     mgr.RemoveTicket(id);
     return(RedirectToAction("Index"));
 }
 public void RemoveTicket(int ticketNumber)
 {
     mgr.RemoveTicket(ticketNumber);
 }