public ActionResult Myorder(int id)
        {
            using (ProjectPeteyEntities ent = new ProjectPeteyEntities())
            {
                // var query =
                //    from post in database.Posts
                //    join meta in database.Post_Metas on post.ID equals meta.Post_ID
                //    where post.ID == id
                //    select new { Post = post, Meta = meta };

                // var query = database.Posts    // your starting point - table in the "from" statement
                //.Join(database.Post_Metas, // the source table of the inner join
                //   post => post.ID,        // Select the primary key (the first part of the "on" clause in an sql "join" statement)
                //   meta => meta.Post_ID,   // Select the foreign key (the second part of the "on" clause)
                //   (post, meta) => new { Post = post, Meta = meta }) // selection
                //.Where(postAndMeta => postAndMeta.Post.ID == id);

                IEnumerable <ViewModel> Myorder_order = null;
                dynamic dmodel = new ExpandoObject();
                dmodel.Myorder_order = (from od in ent.Orders_Details
                                        join oo in ent.Orders on od.Order_Id equals oo.Order_Id
                                        join p in ent.Pets on od.Product_Id equals p.Pet_Id
                                        join pr in ent.Products on od.Product_Id2 equals pr.Product_Id
                                        join t in ent.Trainers on od.Product_Id3 equals t.Trainer_Id
                                        where oo.Customer_Id == id
                                        select new
                {
                    Pid = p.Pet_Id,
                    Pname = p.Gene,
                    Pimages = p.Images,
                    Pprice = (decimal)p.Price,
                    Prid = pr.Product_Id,
                    Prname = pr.Name,
                    Primages = p.Images,
                    Prprice = (decimal)p.Price,

                    Tid = t.Trainer_Id,
                    Tname = t.Name,
                    Timages = t.Images,
                    Tprice = (decimal)t.Price,

                    order_id = oo.Order_Id,
                    time = oo.Order_date
                });
                //var viewModel = new MyViewModel { SemesterFaculties = Myorder_order.ToList() };
                ViewBag.Myorder_order = Myorder_order.ToList();

                return(View(Myorder_order.ToList()));

                //              var Myorder_order =
                //                                from od in ent.Orders_Details
                //                                join oo in ent.Orders on od.Order_Id equals oo.Order_Id
                //                                join p in ent.Pets on od.Product_Id equals p.Pet_Id
                //                                join pr in ent.Products on od.Product_Id2 equals pr.Product_Id
                //                                join t in ent.Trainers on od.Product_Id3 equals t.Trainer_Id
                //                                select new {
                //                                    oo.Order_date, p.Pet_Id, p.Gene, p.Price, pr.Product_Id, pr.Name, pr.Images, t.Trainer_Id
                //                                };
                //var orderd = new List<Orders_Details>();
                //        foreach (var t in Myorder_order)
                //        {
                //            orderd.Add(new Orders_Details()
                //            {
                //                Pet_Id = t.Pet_Id,
                //                Gene = t.Gene,
                //                Images = t.Images,

                //                Pprice = (decimal)t.Price,
                //                Prid = t.Product_Id,
                //                Prname = t.Name,
                //                Primages = t.Images,

                //                Prprice = (decimal)t.Price,
                //                Tid = t.Trainer_Id,
                //                Tname = t.Name,
                //                Timages = t.Images,
                //                Tprice = (decimal)t.Price,

                //                time = t.Order_date


                //        });
                //        }
                //        return View(orderd);
            }
        }
        public ActionResult Login(customer objUser)
        {
            if (ModelState.IsValid)
            {
                using (ProjectPeteyEntities db = new ProjectPeteyEntities())
                {
                    var obj = db.customers.Where(a => a.Username.Equals(objUser.Username) && a.Password.Equals(objUser.Password)).FirstOrDefault();
                    if (obj != null)
                    {
                        Session["UserID"]   = obj.Customer_Id;
                        Session["UserName"] = obj.Username;
                        Session["UserType"] = obj.UserType;
                        if (obj.Shop_name == null && obj.Username != "admin")
                        {
                            Session["Shop_name"]  = "1";
                            Session["CheckLogin"] = "******";
                            if (Session["CheckAlert"] == "1")
                            {
                                Session["CheckAlert"] = "0";
                                return(RedirectToAction("Pet", "Sell", new { area = "" }));
                            }
                            else
                            {
                                return(RedirectToAction("Condition", "Account", new { area = "" }));
                            }
                        }
                        else if (obj.Username == "admin")
                        {
                            Session["Shop_name"]  = "2";
                            Session["CheckLogin"] = "******";
                            Session["CheckAlert"] = "0";
                            return(RedirectToAction("Admin", "Admin", new { area = "" }));
                        }
                        else if (obj.Shop_name != null)
                        {
                            Session["Shop_name"]  = "3";
                            Session["CheckLogin"] = "******";
                            if (Session["CheckAlert"] == "1")
                            {
                                Session["CheckAlert"] = "0";
                                return(RedirectToAction("Pet", "Sell", new { area = "" }));
                            }
                            else
                            {
                                return(RedirectToAction("Condition", "Account", new { area = "" }));
                            }
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        Session["CheckLogin"] = "******";
                        return(RedirectToAction("Login", "Account", new { area = "" }));
                    }
                }
            }

            return(View(objUser));
        }