Beispiel #1
0
        public async Task Delete(Guid id)
        {
            var message = await _dbContext.Messages.FindAsync(id);

            _dbContext.Remove(message);
            await _dbContext.SaveChangesAsync();
        }
Beispiel #2
0
        public async Task <ActionResult> DeleteMessagesWithTicket(int ticketId)
        {
            List <Message> messages = await db.Messages.Where(x => x.TicketId == ticketId).ToListAsync();

            Console.WriteLine();
            foreach (var message in messages)
            {
                db.Remove(message);
            }
            await db.SaveChangesAsync();

            return(Ok());
        }