Ejemplo n.º 1
0
 public void ProductSave(ProductModel Product)
 {
     new MongoDacHelper("product").Save<ProductModel>(Product);
 }
Ejemplo n.º 2
0
        public RedirectResult ProductUpdate(string id = "", string selCategory = "", string txtName = "", int txtPrice = 0, int txtSalePrice = 0, string txtDesc = "", string selUse = "", string txtBom = "")
        {
            ProductModel product = new Dac_Product().ProductView(ObjectId.Parse(id));
            HttpFileCollectionBase files = Request.Files;
            List<string> img = new List<string>();
            ProductModel model = new ProductModel();
            CompanyModel company = new Dac_Company().CompanyInfoDetail(ObjectId.Parse(ConfigurationManager.AppSettings["COM"]));
            ProductCategoryModel category = new Dac_Product().ProductCategorySelectById(ObjectId.Parse(selCategory));
            model.Id = ObjectId.Parse(id);
            model.Company = company;
            model.Description = txtDesc;
            model.Price = txtPrice;
            model.PriceSale = txtSalePrice;
            model.ProductNm = txtName;
            model.ProductCategory = category;
            model.UseYn = selUse == "0" ? true : false;
            model.Bom = txtBom;
            if (files.Count > 0)
            {
                string path = Server.MapPath("/Upload/");
                for (int i = 0; i < files.Count; i++)
                {
                    if (files[i].ContentLength > 0)
                    {
                        img.Add(WebUtill.ImageSave(path, files[i]));
                    }
                }
            }

            if (product.ImagUrl != null)
            {
                foreach (var data in product.ImagUrl)
                {
                    img.Add(data);
                }
            }
            model.ImagUrl = img;
            new Dac_Product().ProductSave(model);
            return Redirect("/Pr/Product");
        }