//[ChildActionOnly] public ActionResult ProceedToCheckOut() { var cartid = sc.GetCartId(this.HttpContext); //Check If already logged in string UserName = sc.GetLoginDetail(cartid); if (UserName == "Guest" || UserName == "") { return(View("CheckOutLogin")); } //Logged in process order else { //var cart = QuickySaleOnlineShopper.Models.ShoppingCart.GetCart(this.HttpContext); //Put a protection block incase the back button is pressed on the site decimal id = 0; if (cartid == null || cartid == "" || UserName == "" || UserName == null) { return(View("Error")); } else { //Send Email on order id = sc.CreateOrder(cartid, UserName); BusinessLayer.SendEmails em = new BusinessLayer.SendEmails(); em.ProcessEmail(cartid); return(RedirectToAction("Complete", "CheckOut", new { id = id })); } } // return View(); }
public ActionResult CheckOutLogIn(FormCollection frmCollection) { //Double chk to ensure this profile is in the userprofile table incase back button was used var cartid = sc.GetCartId(this.HttpContext); if (!sc.ConfirmMemberisLoggedIn(cartid)) { sc.AddGuestBrowserTotblUserProfile(cartid); } //Check if person exists //var ChkCusomer = storeDB.CustomerDetails.Single(x => x.Username == frmCollection["UserName"].ToString()); string dbUserName = frmCollection["UserName"].ToString().Trim(); string dbPwd = frmCollection["Password"].ToString().Trim(); if (sc.CheckMembership(dbUserName, dbPwd)) { //Update tblUserProfile with correct UserName sc.UpdatetblUserProfileWithCurrentUserName(dbUserName, cartid); //Put a protection block incase the back button is pressed on the site decimal id = 0; if (cartid == null || cartid == "" || dbUserName == "" || dbUserName == null) { return(View("Error")); } else { id = sc.CreateOrder(cartid, dbUserName); BusinessLayer.SendEmails em = new BusinessLayer.SendEmails(); em.ProcessEmail(cartid); return(RedirectToAction("Complete", "CheckOut", new { id = id })); } //Send Email on order } else { return(View("ErrorIndex")); } }