示例#1
0
        public ActionResult AddToBasket(MultipleModelInOneView viewModel, FormCollection form)
        {
            Basket basket   = Basket.GetBasket();
            int    quantity = Int32.Parse(form["quantity"]);

            basket.AddToBasket(viewModel.Products.ID, quantity, viewModel.Orders.IMEI);
            return(RedirectToAction("Index"));
        }
示例#2
0
        // GET: Products/Details/5
        public ActionResult Details(int?id)
        {
            var model = new MultipleModelInOneView();

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            model.Products = db.Products.Find(id);
            if (model.Products == null)
            {
                return(HttpNotFound());
            }
            return(View(model));
        }
示例#3
0
        public ActionResult Details(string id)
        {
            try {
                var patientID = id;
                var patient   = _patientRepository.FindByID(patientID);
                var payments  = _paymentService.GetPaymentsByPatientID(patientID);

                MultipleModelInOneView testModel = new MultipleModelInOneView()
                {
                    Patient = patient, Payments = payments
                };

                return(View(testModel));
            }
            catch {
                return(RedirectToAction("Index"));
            }
        }
示例#4
0
        public ActionResult Index()
        {
            if (!Request.Cookies.AllKeys.Contains("cart"))
            {
                return(RedirectToAction("Index", "Basket"));
            }
            MultipleModelInOneView model = new MultipleModelInOneView();
            Checkout modelOne            = new Checkout();

            if (User.Identity.IsAuthenticated)
            {
                ApplicationDbContext entities = new ApplicationDbContext();
                var user = entities.Users.FirstOrDefault(x => x.UserName == User.Identity.Name);
                if (user != null)
                {
                    modelOne.NameOnCard   = user.UserName + " " + user.LastName;
                    modelOne.ContactEmail = user.Email;
                }
            }

            return(View(modelOne));
        }