public void deleteOrderProduct(int id) { OrderProduct OrderProduct = OrderProductRepository.GetById(id); OrderProductRepository.Delete(OrderProduct); SaveChange(); }
public bool Delete(int?Id) { var getId = Get(Id); if (getId != null) { _orderproductRepository.Delete(Id); status = true; } return(status); }
public ActionResult DeleteOrder(int orderId) { var order = _orderRepository.GetById(orderId); var orderProducts = _orderProductRepository.GetMany(o => o.Order.Id == orderId); foreach (var itemOP in orderProducts) { _orderProductRepository.Delete(itemOP); } _orderRepository.Delete(order); if (order != null) { TempData["Message"] = string.Format("{0} was deleted", order.Id); } _unitOfWork.Commit(); return(RedirectToAction("Index")); }