Пример #1
0
        public ActionResult addProductToCar(FormCollection formCollection)
        {
            System.Diagnostics.Debug.WriteLine(" >>>> addProductToCar -------------------------->>>> ");
            System.Diagnostics.Debug.WriteLine(" >>>> app_ser: " + formCollection["app_ser"]);
            System.Diagnostics.Debug.WriteLine(" >>>> pro_class_name: " + formCollection["pro_class_name"]);
            System.Diagnostics.Debug.WriteLine(" >>>> prod_desc: " + formCollection["prod_desc"]);
            System.Diagnostics.Debug.WriteLine(" >>>> prod_feature: " + formCollection["prod_feature"]);
            System.Diagnostics.Debug.WriteLine(" >>>> prod_name: " + formCollection["prod_name"]);
            System.Diagnostics.Debug.WriteLine(" >>>> prod_no: " + formCollection["prod_no"]);
            System.Diagnostics.Debug.WriteLine(" >>>> prod_price: " + formCollection["prod_price"]);
            System.Diagnostics.Debug.WriteLine(" >>>> prod_special_price: " + formCollection["prod_special_price"]);

            PreOrderModel pom = new PreOrderModel();
            pom.app_ser = wf.toi(formCollection["app_ser"]);
            pom.pro_class_name = wf.tos(formCollection["pro_class_name"]);
            pom.prod_desc = wf.tos(formCollection["prod_desc"]);
            pom.prod_feature = wf.tos(formCollection["prod_feature"]);
            pom.prod_name = wf.tos(formCollection["prod_name"]);
            pom.prod_no = wf.tos(formCollection["prod_no"]);
            pom.prod_price = wf.toi(formCollection["prod_price"]);
            pom.prod_special_price = wf.toi(formCollection["prod_special_price"]);
            pom.create_date = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
            pom.update_date = DateTime.SpecifyKind(DateTime.Now, DateTimeKind.Utc);
            pom.user_app_ser = wf.toi(Session["app_ser"]);
            pom.user_id = wf.tos(Session["user_id"]);
            pom.user_name = wf.tos(Session["user_name"]);

            mongoDao.CreatePreOrder(pom);

            Hashtable myHT = new Hashtable();
            myHT.Add("preOrderList", mongoDao.GetAllPreOder());
            string obj_json = JsonConvert.SerializeObject(myHT);
            return Content(obj_json, "application/json");
        }
Пример #2
0
 // Creates a Task and inserts it into the collection in MongoDB.
 public void CreatePreOrder(PreOrderModel preOrder)
 {
     MongoCollection<PreOrderModel> collection = GetPreOrderCollectionForEdit();
     try
     {
         collection.Insert(preOrder, SafeMode.True);
     }
     catch (MongoCommandException ex)
     {
         string msg = ex.Message;
     }
 }