public ActionResult SaveChanges(int ListItemId, string SPHostUrl, Customer customer)
        {
            var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

            using (var ctx = spContext.CreateUserClientContextForSPHost())
            {
                CustomerItemHelper.SaveChangesToCustomer(ListItemId, customer, ctx);
                return(RedirectToAction("Index", new { ListItemId = ListItemId, SPHostUrl = SPHostUrl, IsUpdated = true }));
            }
        }
        public ActionResult NewOrder(Order order, string SPHostUrl)
        {
            var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

            using (var ctx = spContext.CreateUserClientContextForSPHost())
            {
                OrderListHelper.CreateNewOrder(ctx, order);
                CustomerItemHelper.UpdateLastOrderMade(ctx, order.Customer);
            }
            return(RedirectToAction("Index", new { ListItemId = order.Customer, SPHostUrl = SPHostUrl }));
        }
        public ActionResult NewOrder(int ListItemId)
        {
            var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

            using (var ctx = spContext.CreateUserClientContextForSPHost())
            {
                Customer customer = CustomerItemHelper.GetCustomerFromSharepoint(ListItemId, ctx);
                ViewBag.termset     = OrderListHelper.GetTaxonomyTermSet(ctx);
                ViewBag.listitem    = ListItemId;
                ViewBag.CompanyName = customer.Title;
                return(View());
            }
        }
        public ActionResult Index(int ListItemId, int?ListId, string SPHostUrl)
        {
            var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

            using (var ctx = spContext.CreateUserClientContextForSPHost())
            {
                // ViewBag.IsUpdated = IsUpdated;
                ViewBag.OrderList = OrderListHelper.GetOrderList(ListItemId, ctx);
                Customer customer = CustomerItemHelper.GetCustomerFromSharepoint(ListItemId, ctx);
                ViewBag.CustomerId = ListItemId;
                ViewBag.SPHostUrl  = SPHostUrl;
                return(View(customer));
            }
        }
        public ActionResult Index(string SPHostUrl)
        {
            var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

            using (var ctx = spContext.CreateUserClientContextForSPHost())
            {
                if (ctx != null)
                {
                    List <Customer> customerModel = CustomerItemHelper.ReturnCustomerList(ctx);
                    ViewBag.SPHostUrl = SPHostUrl;
                    return(View(customerModel));
                }
            }
            return(View());
        }
Example #6
0
        public ActionResult RandomCustomer(string SPHostUrl)
        {
            var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

            using (var ctx = spContext.CreateUserClientContextForSPHost())
            {
                if (ctx != null)
                {
                    Customer customerToReturn = CustomerItemHelper.ReturnRandomCustomer(CustomerItemHelper.GetCustomerWithoutOrder(ctx), ctx);
                    if (customerToReturn != null)
                    {
                        return(RedirectToAction("Index", "CustomerCard", new { ListItemId = customerToReturn.Id, SPHostUrl = SPHostUrl }));
                    }
                }
            }
            return(View("NoRandomCustomer"));
        }