Exemplo n.º 1
0
 public ActionResult Create(Product product, HttpPostedFileBase file)
 {
     if (file != null)
     {
         product.Image = file.FileName;
         file.SaveAs(Server.MapPath("//Content//ProductImage//") + product.Image);
     }
     items.Insert(product);
     items.Commit();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 2
0
        //public Order showOrder()
        //{
        //    Order order = orderContext.DisplayAll().Where(p => p.Email == User.Identity.Name).FirstOrDefault();
        //    return order;
        //}

        public void generateOrder(Order order, List <ItemListViewModel> basketItems)
        {
            foreach (var item in basketItems)
            {
                order.orderItems.Add(new OrderItem()
                {
                    itemImage    = item.itemImage,
                    itemPrice    = item.itemPrice,
                    itemName     = item.itemName,
                    itemQuentity = item.itemQuentity
                });
            }
            orderContext.Insert(order);
            orderContext.Commit();
        }
Exemplo n.º 3
0
        public async Task <ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser {
                    UserName = model.Email, Email = model.Email
                };
                var result = await UserManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    GenericDataAccess <Customer> customers = new GenericDataAccess <Customer>(new DataContext());
                    Customer customer = new Customer()
                    {
                        city      = model.city,
                        state     = model.state,
                        street    = model.street,
                        firstName = model.firstName,
                        lastName  = model.lastName,
                        zipCode   = model.zipCode,
                        Email     = model.Email,
                        userID    = user.Id,
                    };

                    customers.Insert(customer);
                    customers.Commit();


                    await SignInManager.SignInAsync(user, isPersistent : false, rememberBrowser : false);

                    // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771
                    // Send an email with this link
                    // string code = await UserManager.GenerateEmailConfirmationTokenAsync(user.Id);
                    // var callbackUrl = Url.Action("ConfirmEmail", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme);
                    // await UserManager.SendEmailAsync(user.Id, "Confirm your account", "Please confirm your account by clicking <a href=\"" + callbackUrl + "\">here</a>");

                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            // If we got this far, something failed, redisplay form
            return(View(model));
        }
 //[ActionName("Update")]
 public ActionResult UpdateOrder(string id, Order order)
 {
     orderContext.Update(order, id);
     orderContext.Commit();
     return(RedirectToAction("Index"));
 }
Exemplo n.º 5
0
 public ActionResult Create(OrderStatus Newstatus)
 {
     status.Insert(Newstatus);
     status.Commit();
     return(RedirectToAction("Index"));
 }
 public ActionResult Create(ProductCategory product)
 {
     items.Insert(product);
     items.Commit();
     return(RedirectToAction("Index"));
 }