public async Task <OrderDTO> OrderDelete(OrderDTO orderDTO) { var dataObject = orderDTO as ResturantOrder; _sqlServerContext.Remove <ResturantOrder>(dataObject); await _sqlServerContext.SaveChangesAsync(); return(orderDTO); }
public async Task <LocationDTO> LocationDelete(LocationDTO locationDTO) { var dataObject = locationDTO as Location; _sqlServerContext.Remove <Location>(dataObject); await _sqlServerContext.SaveChangesAsync(); return(locationDTO); }
public async Task <ProductDTO> ProductDelete(ProductDTO productDTO) { var dataObject = productDTO as Product; _sqlServerContext.Remove <Product>(dataObject); await _sqlServerContext.SaveChangesAsync(); return(productDTO); }
public async Task <CustomerDTO> CustomerDelete(CustomerDTO customerDTO) { var dataObejct = customerDTO as CustomerDTO; _sqlServerContext.Remove(customerDTO); await _sqlServerContext.SaveChangesAsync(); return(customerDTO); }
public async Task <EmployeeDTO> EmployeeDelete(EmployeeDTO employeeDTO) { var dataObject = employeeDTO as Employee; _sqlServerContext.Remove <Employee>(dataObject); await _sqlServerContext.SaveChangesAsync(); return(employeeDTO); }
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)); }
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; } }