Exemplo n.º 1
0
        public ActionResult Create(modelAdaptor modelAdaptor)
        {
            db.FAQs.Add(modelAdaptor.faq);
            db.SaveChanges();

            return(RedirectToAction("Admin_Faq", "Admin"));
        }
Exemplo n.º 2
0
        // GET: FAQ
        public ActionResult Index()
        {
            modelAdaptor modelAdaptor = new modelAdaptor();

            modelAdaptor.faqs = db.FAQs.ToList();
            return(View(modelAdaptor));
        }
Exemplo n.º 3
0
        // GET: Product
        public ActionResult Index()
        {
            modelAdaptor modelAdaptor = new modelAdaptor();

            modelAdaptor.products = db.Products.ToList();
            return(View(modelAdaptor));
        }
Exemplo n.º 4
0
        public ActionResult Create(modelAdaptor modelAdaptor)
        {
            db.Careers.Add(modelAdaptor.career);
            db.SaveChanges();

            return(RedirectToAction("Admin_Career", "Admin"));
        }
Exemplo n.º 5
0
        // GET: career
        public ActionResult Index()
        {
            modelAdaptor modelAdaptor = new modelAdaptor();

            modelAdaptor.careers = db.Careers.ToList();
            return(View(modelAdaptor));
        }
Exemplo n.º 6
0
        public ActionResult Update(modelAdaptor modelAdaptor)
        {
            var getFaq = db.FAQs.FirstOrDefault(F => F.Id.Equals(modelAdaptor.faq.Id));

            getFaq.Question = modelAdaptor.faq.Question;
            getFaq.Answer   = modelAdaptor.faq.Answer;
            db.SaveChanges();
            return(RedirectToAction("Admin"));
        }
        public ActionResult Index(modelAdaptor ma)
        {
            Message message = new Message();

            message = ma.message;
            Debug.WriteLine(ma.message.Name, ma.message.Email);
            db.Messages.Add(message);
            db.SaveChanges();
            return(View("success"));
        }
Exemplo n.º 8
0
        public ActionResult Ship(modelAdaptor ma)
        {
            int   orderNo = ma.order.orderNo;
            Order order   = db.orders.Where(o => o.orderNo.Equals(orderNo)).FirstOrDefault();

            order.orderStatus    = "Shipped";
            order.trackingNumber = ma.order.trackingNumber;
            db.SaveChanges();
            return(RedirectToAction("Admin_Order", "Admin"));
        }
Exemplo n.º 9
0
        public ActionResult createShipInfo(modelAdaptor ma)
        {
            UserInfo userInfo = new UserInfo();

            userInfo          = ma.userInfo;
            userInfo.username = Session["username"].ToString();
            db.UserInfos.Add(userInfo);
            db.SaveChanges();
            return(RedirectToAction("CheckOut"));
        }
Exemplo n.º 10
0
        public ActionResult createPaymentInfo(modelAdaptor ma, DateTime expireDate)
        {
            paymentInfo pi = new paymentInfo();

            pi            = ma.paymentInfo;
            pi.username   = Session["username"].ToString();
            pi.expireDate = expireDate;
            db.PaymentInfos.Add(pi);
            db.SaveChanges();
            return(RedirectToAction("CheckOut"));
        }
Exemplo n.º 11
0
        public ActionResult Update(modelAdaptor modelAdaptor)
        {
            var getcareer = db.Careers.FirstOrDefault(F => F.Id.Equals(modelAdaptor.career.Id));

            getcareer.jobTitle        = modelAdaptor.career.jobTitle;
            getcareer.Type            = modelAdaptor.career.Type;
            getcareer.Reference       = modelAdaptor.career.Reference;
            getcareer.Location        = modelAdaptor.career.Location;
            getcareer.Hours           = modelAdaptor.career.Hours;
            getcareer.roleDescription = modelAdaptor.career.roleDescription;
            db.SaveChanges();
            return(RedirectToAction("Admin_Career", "Admin"));
        }
Exemplo n.º 12
0
 public ActionResult Admin_order()
 {
     if (Session["adminName"] != null)
     {
         modelAdaptor ma = new modelAdaptor();
         ma.orders = db.orders.ToList();
         return(View(ma));
     }
     else
     {
         return(RedirectToAction("Index", "Admin"));
     }
 }
Exemplo n.º 13
0
 public ActionResult Admin_Faq()
 {
     if (Session["adminName"] != null)
     {
         modelAdaptor modelAdaptor = new modelAdaptor();
         modelAdaptor.faqs = db.FAQs.ToList();
         return(View(modelAdaptor));
     }
     else
     {
         return(RedirectToAction("Index", "Admin"));
     }
 }
Exemplo n.º 14
0
 public ActionResult Update(int id)
 {
     if (Session["adminName"] != null)
     {
         FAQ          faq          = db.FAQs.Where(f => f.Id.Equals(id)).FirstOrDefault();
         modelAdaptor modelAdaptor = new modelAdaptor();
         modelAdaptor.faq = faq;
         return(View(modelAdaptor));
     }
     else
     {
         return(RedirectToAction("Index", "Admin"));
     }
 }
Exemplo n.º 15
0
 public ActionResult Admin_Career()
 {
     if (Session["adminName"] != null)
     {
         modelAdaptor modelAdaptor = new modelAdaptor
         {
             careers = db.Careers.ToList()
         };
         return(View(modelAdaptor));
     }
     else
     {
         return(RedirectToAction("Index", "Admin"));
     }
 }
Exemplo n.º 16
0
 public ActionResult Ship(int id)
 {
     if (Session["adminName"] != null)
     {
         modelAdaptor ma    = new modelAdaptor();
         Order        order = new Order();
         order.orderNo = id;
         ma.order      = order;
         return(View(ma));
     }
     else
     {
         return(RedirectToAction("Index", "Admin"));
     }
 }
Exemplo n.º 17
0
 public ActionResult Order()
 {
     if (Session["username"] != null)
     {
         modelAdaptor ma        = new modelAdaptor();
         string       username  = Session["username"].ToString();
         var          orderInfo = db.orders.Where(o => o.username.Equals(username)).ToList();
         ma.orders = orderInfo;
         return(View(ma));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
Exemplo n.º 18
0
 public new ActionResult Profile()
 {
     if (Session["adminName"] != null)
     {
         modelAdaptor ma       = new modelAdaptor();
         string       username = Session["username"].ToString();
         var          userInfo = db.UserInfos.Where(u => u.username.Equals(username)).FirstOrDefault();
         ma.userInfo = userInfo;
         return(View(ma));
     }
     else
     {
         return(RedirectToAction("Index", "Admin"));
     }
 }
Exemplo n.º 19
0
        // GET: Cart

        public ActionResult Index()
        {
            modelAdaptor   ma       = new modelAdaptor();
            string         username = Session["username"].ToString();
            List <Cart>    carts    = db.carts.Where(u => u.username.Equals(username)).ToList();
            List <Product> products = db.Products.ToList();
            var            list     = (from c in carts
                                       join p in products
                                       on c.productId equals p.Id
                                       select new Cart {
                quantity = c.quantity, product = p, productId = c.productId
            }).ToList();

            ma.carts = list;
            return(View(ma));
        }
Exemplo n.º 20
0
 public ActionResult Confirm(modelAdaptor ma, string userInfoSelect, string paymentInfo)
 {
     if (userInfoSelect != null && paymentInfo != null)
     {
         Order order = new Order();
         order.username     = Session["username"].ToString();
         order.email        = db.UserInfos.Where(e => e.username.Equals(order.username)).FirstOrDefault().email;
         order.shipmentInfo = userInfoSelect;
         order.paymentInfo  = paymentInfo;
         order.orderStatus  = "Processing";
         int    amount     = 0;
         string orderItems = "";
         var    au         = db.carts.Where(u => u.username.Equals(order.username)).ToList();
         var    pu         = db.Products.ToList();
         var    bu         = (from a in au
                              join p in pu
                              on a.productId equals p.Id
                              select new
         {
             name = p.Name,
             quantity = a.quantity,
             price = p.Price
         }).ToList();
         foreach (var item in bu)
         {
             orderItems += item.name + "*" + item.quantity + " ,";
             amount     += item.price * item.quantity;
         }
         order.orderItems = orderItems.Substring(0, orderItems.Length - 1) + " Amount: " + amount;
         order.orderTime  = DateTime.Now;
         db.orders.Add(order);
         db.carts.RemoveRange(au);
         db.SaveChanges();
         return(View());
     }
     else
     {
         ViewBag.checkout = "Please check required filed!";
         return(RedirectToAction("CheckOut"));
     }
 }
Exemplo n.º 21
0
        public ActionResult CartOperation(modelAdaptor ma, string operation)
        {
            if (ma.carts != null)
            {
                string username = Session["username"].ToString();
                if (operation.Equals("delete"))
                {
                    var a = ma.carts.Where(s => s.isSelected == true).ToList();
                    foreach (var item in a)
                    {
                        Cart cart = new Cart();
                        cart = db.carts.Where(i => i.productId.Equals(item.productId)).Where(u => u.username.Equals(username)).FirstOrDefault();
                        db.carts.Remove(cart);
                        db.SaveChanges();
                    }

                    return(RedirectToAction("Index"));
                }
                else if (operation.Equals("checkOut"))
                {
                    modelAdaptor ma2      = new modelAdaptor();
                    var          a        = ma.carts.Where(s => s.isSelected == true).ToList();
                    List <Cart>  cartInfo = new List <Cart>();
                    if (a.Count() > 0)
                    {
                        foreach (var item in a)
                        {
                            Cart cart = new Cart();
                            cart = db.carts.Where(i => i.productId.Equals(item.productId)).Where(u => u.username.Equals(username)).FirstOrDefault();
                            cartInfo.Add(cart);
                        }
                        var checkoutInfo = (from c in cartInfo
                                            join p in db.Products.ToList()
                                            on c.productId equals p.Id
                                            select new Cart {
                            product = p, quantity = c.quantity
                        }).ToList();
                        var shipInfo = db.UserInfos.Where(u => u.username.Equals(username)).ToList();
                        var payInfo  = db.PaymentInfos.Where(u => u.username.Equals(username)).ToList();
                        ma2.carts        = checkoutInfo;
                        ma2.userInfos    = shipInfo;
                        ma2.paymentInfos = payInfo;
                        return(View("checkOut", ma2));
                    }
                    else
                    {
                        ViewBag.blankCart = "Empty!";
                        return(RedirectToAction("Index"));
                    }
                }
                else if (operation.Equals("chooseMore"))
                {
                    return(RedirectToAction("Index", "Product"));
                }
                else
                {
                    return(RedirectToAction("Index"));
                }
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
Exemplo n.º 22
0
 public ActionResult checkOut(modelAdaptor ma)
 {
     return(View(ma));
 }