Exemple #1
0
        public ActionResult About()
        {
            ViewBag.Message = "Page with Bing Maps.";

            var mongoContext = new mongoCloud();

            var allCustomers = mongoContext.Customers.Find(x => true).ToList();

            //Data d = new Data();

            ViewBag.Customers = allCustomers;
            //d.GetCustomers();

            return(View());
        }
Exemple #2
0
        public JsonResult AddCustomer(string CustomerName, string CustomerAddress, string CustomerPhone)
        {
            var mongoContext = new mongoCloud();


            //Data d = new Data();

            //d.AddCustomer(CustomerName, CustomerAddress, CustomerPhone);

            var customer = new BCustomer
            {
                NAME    = CustomerName,
                ADDRESS = CustomerAddress,
                PHONE   = CustomerPhone
            };

            mongoContext.Customers.InsertOne(customer);

            return(Json(new { Data = RenderRazorViewToString("Customers",
                                                             mongoContext.Customers.Find(x => true).ToList()) }));
        }