Exemplo n.º 1
0
        public async Task <IActionResult> DeleteCity(int id)
        {
            var cityToDelete = await _context.City.FirstOrDefaultAsync(c => c.Cityid == id);

            if (cityToDelete != null)
            {
                _context.Remove(cityToDelete);
                return(Ok(await _context.SaveChangesAsync()));
            }
            else
            {
                return(BadRequest());
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> DeleteCustomer(int id)
        {
            var customerToDelete = await _context.Customer.FirstOrDefaultAsync(c => c.Customerid == id);

            if (customerToDelete != null)
            {
                _context.Remove(customerToDelete);
                await TimeStampTransaction();

                return(Ok(await _context.SaveChangesAsync()));
            }

            await TimeStampError();

            return(BadRequest());
        }