Example #1
0
        public void UpdateGiftOrderDetails(ConfirmGiftCards confirmGiftCards)
        {
            var     order = _giftCardOrderRepository.Find(confirmGiftCards.GiftOrderId);
            decimal total = 0;

            foreach (var details in confirmGiftCards.GiftOrderDetail)
            {
                var orderDetail = FindGiftOrderDetail(details.Id);
                orderDetail.InjectFrom(details);
                _giftOrderDetailRepository.Update(orderDetail);

                total = total + details.Amount;
            }
            order.Total     = total;
            order.ItemTotal = total;
            _giftCardOrderRepository.Update(order);
        }
        public ActionResult StartGiftOrders(ConfirmGiftCards giftcards)
        {
            try
            {
                if (Request.IsAjaxRequest())
                {

                    if (!ModelState.IsValid)
                    {
                        foreach (var value in ModelState.Values.ToList())
                        {
                            foreach (var error in value.Errors)
                            {
                                ModelState.AddModelError(string.Empty, error.ErrorMessage);
                            }
                        }

                        return PartialView("_GiftOrderDetails", giftcards);
                    }

                    else
                    {
                        _giftCardOrderService.UpdateGiftOrderDetails(giftcards);
                        return Redirect(Url.RouteUrl("billing-orderdetails", new { orderId = giftcards.GiftOrderId }));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "You must add at least one quantity for this gift order.");
                    return PartialView("_GiftOrderDetails", giftcards);
                }
            }
            catch (Exception e)
            {
                Elmah.ErrorSignal.FromCurrentContext().Raise(e);
                return PartialView("_GiftOrderDetails");
            }
        }
        public void UpdateGiftOrderDetails(ConfirmGiftCards confirmGiftCards)
        {
            var order = _giftCardOrderRepository.Find(confirmGiftCards.GiftOrderId);
              decimal total = 0;
              foreach (var details in confirmGiftCards.GiftOrderDetail)
              {
              var orderDetail = FindGiftOrderDetail(details.Id);
              orderDetail.InjectFrom(details);
              _giftOrderDetailRepository.Update(orderDetail);

              total = total + details.Amount;
              }
              order.Total = total;
              order.ItemTotal = total;
              _giftCardOrderRepository.Update(order);
        }