Beispiel #1
0
        //______________________________________________________________________________________

        /// <summary>
        /// GET: MyAccount/MyOrders
        /// </summary>
        /// <returns></returns>

        public ActionResult MyOrders()
        {
            if (Session["usertype"] != null)
            {
                return(View(LetsShopImplementation.GetMyOrders(@User.Identity.Name)));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
Beispiel #2
0
        //______________________________________________________________________________________

        /// <summary>
        /// GET: MyAccount/ExportMyOrders [Exports all users to an Excel File]
        /// </summary>
        /// <returns></returns>

        public ActionResult ExportMyOrders()
        {
            try
            {
                GridView gv = new GridView();
                gv.DataSource = LetsShopImplementation.GetMyOrders(@User.Identity.Name);
                gv.DataBind();
                Response.ClearContent();
                Response.AddHeader("content-disposition", "attachment; filename=MyOrders.xls");
                Response.ContentType = "application/excel";
                StringWriter   sw  = new StringWriter();
                HtmlTextWriter htw = new HtmlTextWriter(sw);
                gv.RenderControl(htw);
                Response.Write(sw.ToString());
                Response.End();
            }
            catch (Exception)
            {
                return(RedirectToAction("ErrorPage", "Product"));
            }
            return(View("Index"));
        }