コード例 #1
0
        public async Task <OrderDTO> OrderDelete(OrderDTO orderDTO)
        {
            var dataObject = orderDTO as ResturantOrder;

            _sqlServerContext.Remove <ResturantOrder>(dataObject);
            await _sqlServerContext.SaveChangesAsync();

            return(orderDTO);
        }
コード例 #2
0
        public async Task <LocationDTO> LocationDelete(LocationDTO locationDTO)
        {
            var dataObject = locationDTO as Location;

            _sqlServerContext.Remove <Location>(dataObject);
            await _sqlServerContext.SaveChangesAsync();

            return(locationDTO);
        }
コード例 #3
0
        public async Task <ProductDTO> ProductDelete(ProductDTO productDTO)
        {
            var dataObject = productDTO as Product;

            _sqlServerContext.Remove <Product>(dataObject);
            await _sqlServerContext.SaveChangesAsync();

            return(productDTO);
        }
コード例 #4
0
        public async Task <CustomerDTO> CustomerDelete(CustomerDTO customerDTO)
        {
            var dataObejct = customerDTO as CustomerDTO;

            _sqlServerContext.Remove(customerDTO);
            await _sqlServerContext.SaveChangesAsync();

            return(customerDTO);
        }
コード例 #5
0
        public async Task <EmployeeDTO> EmployeeDelete(EmployeeDTO employeeDTO)
        {
            var dataObject = employeeDTO as Employee;

            _sqlServerContext.Remove <Employee>(dataObject);
            await _sqlServerContext.SaveChangesAsync();

            return(employeeDTO);
        }
コード例 #6
0
        public async Task <ActionResult <Product> > Delete(int id)
        {
            var product = await _productsDbContext.Products.FindAsync(id);

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

            _productsDbContext.Remove(product);
            await _productsDbContext.SaveChangesAsync();

            return(Ok(product));
        }
コード例 #7
0
        public void Delete(int id)
        {
            T result = dataSet.SingleOrDefault(prop => prop.Id.Equals(id));

            try
            {
                if (result != null)
                {
                    _context.Remove(result);
                }
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }