示例#1
0
        public IActionResult BillDetail(int billId)
        {
            BillModelView   bill     = GetBills().SingleOrDefault(p => p.BillId == billId);
            DeliveryProduct delivery = GetApiDeliveryProducts.GetDeliveryProducts().SingleOrDefault(p => p.DeliveryProductBillId == bill.BillId);

            bill.delivery = delivery;
            return(View(bill));
        }
示例#2
0
        public IActionResult BillDetail(int billId)
        {
            CredentialManage credential = JsonConvert.DeserializeObject <CredentialManage>(HttpContext.Session.GetString(Constants.VM_MANAGE));

            Bill          p    = GetApiBills.GetBills(credential).SingleOrDefault(p => p.BillId == billId);
            BillModelView bill = new BillModelView()
            {
                BillId            = p.BillId,
                BillCode          = p.GenerateCodeCheck,
                DateOfPurchase    = p.DateOfPurchase,
                DateDelivery      = Convert.ToDateTime(p.DateOfDelivered),
                TotalPrice        = p.TotalPrice,
                PaymentMethodId   = p.PaymentMethodTypeId,
                IsDelivery        = p.IsDelivery,
                IsCancel          = p.IsCancel,
                IsApprove         = p.IsApprove,
                IsCompleted       = p.IsCompleted,
                PaymentMethodName = GetApiPaymentMethodTypes.GetPaymentMethodTypes().SingleOrDefault(k => k.PaymentMethodTypeId == p.PaymentMethodTypeId).PaymentMethodTypeName,
            };

            List <BillDetailModel> details = GetApiBillDetails.GetBillDetails().Where(p => p.BillId == bill.BillId)
                                             .Select(p => new BillDetailModel()
            {
                ProductId   = p.ProductId,
                ProductName = GetApiProducts.GetProducts().SingleOrDefault(k => k.ProductId == p.ProductId).ProductName,
                Amount      = p.ProductAmount,
                Price       = p.ProductPriceCurrent,
                NoteSize    = p.NoteSize,
                Image       = GetApiProducts.GetProducts().SingleOrDefault(k => k.ProductId == p.ProductId).ProductImage,
            }).ToList();

            bill.BillDetail = details;

            // get delivery
            DeliveryProduct delivery = GetApiDeliveryProducts.GetDeliveryProducts().SingleOrDefault(p => p.DeliveryProductBillId == bill.BillId);

            bill.delivery = delivery;

            // get state of bill
            bill.DeliveryProductStateId = delivery.DeliveryProductStateId;

            bill.DeliveryStateName = GetApiDeliveryStates.GetDeliveryProductStates().SingleOrDefault(p => p.DeliveryProductStateId == delivery.DeliveryProductStateId).DeliveryProductStateName;

            return(Json(bill));
        }