示例#1
0
        public ActionResult ProductDetail(int?Product_ID, string message)
        {
            //adding to previsit if customer is login
            if (Session["CustomerID"] != null)
            {
                var id = Convert.ToInt32(Session["CustomerID"]);

                var modelPVV = _db.PreVisit.Where(o => o.Product_ID == Product_ID && o.Customer_ID == id).FirstOrDefault();
                if (modelPVV != null)
                {
                    modelPVV.Date             = DateTime.Now;
                    _db.Entry(modelPVV).State = EntityState.Modified;
                }
                else
                {
                    var modelPV = new PreVisit();
                    modelPV.Date        = DateTime.Now;
                    modelPV.Product_ID  = Convert.ToInt64(Product_ID);
                    modelPV.Customer_ID = id;
                    _db.PreVisit.Add(modelPV);
                }

                _db.SaveChanges();
            }



            var modelP  = _db.Product.Where(p => p.ID == Product_ID).FirstOrDefault();
            var modelPD = _db.ProductDescrption.Where(p => p.Product_ID == Product_ID).FirstOrDefault();
            var modelPP = _db.ProductPicture.Where(p => p.Product_ID == Product_ID).FirstOrDefault();
            ProductPictureDescrption model = new ProductPictureDescrption();


            model.ProductName        = modelP.ProductName;
            model.ProductPrice       = modelP.ProductPrice;
            model.ProductQuantity    = modelP.ProductQuantity;
            model.ProductDiscount    = modelP.ProductDiscount;
            model.ProductCategory    = modelPD.ProductCategory;
            model.ProductSubCategory = modelPD.ProductSubCategory;
            model.ProductBrand       = modelPD.ProductBrand;
            model.ProductGenderType  = modelPD.ProductGenderType;
            model.ProductDescription = modelPD.ProductDescription;
            model.PicturePath        = modelPP.PicturePath;
            model.ID = modelP.ID;


            ViewBag.Message = message;
            return(View(model));
        }
示例#2
0
        public Boolean setPrevisit(long Customer_ID, long Product_ID)
        {
            var check = _preVisitDA.checkExistance(Customer_ID, Product_ID);

            if (check == true)      //if exist then do nothing
            {
                return(true);
            }

            var entity = new PreVisit();

            entity.Date        = DateTime.Now;
            entity.Customer_ID = Customer_ID;
            entity.Product_ID  = Product_ID;
            if (_preVisitDA.AddPrevist(entity))
            {
                return(true);
            }
            return(false);
        }
示例#3
0
 public Boolean AddPrevist(PreVisit entity)          //Add previsit for Cusromer
 {
     db.PreVisit.Add(entity);
     db.SaveChanges();
     return(true);
 }
示例#4
0
文件: Dfs.cs 项目: MattSi/Maze
 public Dfs(Graph g, PreVisit preVisit = null, PostVisit postVisit = null)
 {
     _graph     = g;
     _preVisit  = preVisit;
     _postVisit = postVisit;
 }