public ActionResult Order_Details(string id)
 {
     if (id == null)
     {
         return(RedirectToAction("Bad_Request", "Error"));
     }
     if (order_Service.GetOrder(id) != null)
     {
         return(View(order_Service.GetOrderDetail(id)));
     }
     else
     {
         return(RedirectToAction("Not_Found", "Error"));
     }
 }
        public ActionResult Payment(string id)
        {
            var order = db.Orders.Find(id);

            ViewBag.Order   = order;
            ViewBag.Account = customer_Service.findCustomer_by_email(order.members.Email);
            ViewBag.Address = address_Service.allOrderAddreses().Find(x => x.Order_ID == order.Order_ID);
            ViewBag.Items   = order_Service.allOrderItems(order.Order_ID);
            ViewBag.Total   = order_Service.get_order_total(order.Order_ID);


            try
            {
                string url   = "<a href=" + "http://shopify-here.azurewebsites.net/Shopping/Payment/" + id + " >  here" + "</a>";
                string table = "<br/>" +
                               "Items in this order<br/>" +
                               "<table>";
                table += "<tr>" +
                         "<th>Item</th>"
                         +
                         "<th>Quantity</th>"
                         +
                         "<th>Price</th>" +
                         "</tr>";
                foreach (var item in (List <Order_Item>)ViewBag.Items)
                {
                    string itemsinoder = "<tr> " +
                                         "<td>" + item.Item.Name + " </td>" +
                                         "<td>" + item.quantity + " </td>" +
                                         "<td>" + item.Picture + " </td>" +
                                         "<td>R" + item.price + " </td>" +
                                         "<tr/>";
                    table += itemsinoder;
                }

                table += "<tr>" +
                         "<th></th>"
                         +
                         "<th></th>"
                         +
                         "<th></th>"
                         +
                         "<th>" + order_Service.get_order_total(order.Order_ID).ToString("R0.00") + "</th>" +
                         "</tr>";
                table += "</table>";

                var client      = new SendGridClient("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");
                var from        = new EmailAddress("*****@*****.**", "Power of God Online Store");
                var subject     = "Order " + id + " | Awaiting Payment";
                var to          = new EmailAddress(((Members)ViewBag.Account).Email, ((Members)ViewBag.Account).FirstName + " " + ((Members)ViewBag.Account).LastName);
                var htmlContent = "Hi " + order.members.FirstName + ", Your order was placed, you can securely pay your order from " + url + table;
                var msg         = MailHelper.CreateSingleEmail(from, to, subject, null, htmlContent);
                var response    = client.SendEmailAsync(msg);
            }
            catch (Exception ex)
            {
            }
            //return View();



            return(View(order_Service.GetOrderDetail(id)));
        }
Пример #3
0
 public ActionResult Payment(string id)
 {
     return(View(order_Service.GetOrderDetail(id)));
 }