コード例 #1
0
ファイル: HomeController.cs プロジェクト: LeDuy1993/CS_Coffee
        public IActionResult Delete(int pid, int id)
        {
            var productOD   = productOrderDetailRepository.Get(id);
            var orderDetail = orderDetailRepository.Get(productOD.OrderDetailId);
            var delPOD      = productOrderDetailRepository.Delete(id);
            var delOD       = orderDetailRepository.Delete(orderDetail.OrderDetailId);

            if (delOD && delPOD)
            {
                var orderDetailCheck = (from od in orderDetailRepository.Gets()
                                        where od.OrderId == pid && od.Paid == false
                                        select od).FirstOrDefault();
                if (orderDetailCheck != null)
                {
                    var url = "https://localhost:44366/Home/Index/" + orderDetail.OrderId;
                    return(Redirect(url));
                }
                else
                {
                    var order = orderRepository.Get(pid);
                    order.Using = false;
                    var result = orderRepository.Edit(order);
                    if (result != null)
                    {
                        var url = "https://localhost:44366/Home/Index/" + orderDetail.OrderId;
                        return(Redirect(url));
                    }
                }
            }
            return(View());
        }
コード例 #2
0
 public void Delete(ProductOrderDetail entity)
 {
     _productOrderDetailRepository.Delete(entity);
 }