示例#1
0
        public ActionResult AddProduct(string title, string description, string price)
        {
            HttpStatusCodeResult httpCode = new HttpStatusCodeResult(HttpStatusCode.MethodNotAllowed);

            var spContext = SharePointContextProvider.Current.GetSharePointContext(HttpContext);

            Product newProduct = new Product();

            newProduct.Title       = title;
            newProduct.Description = description;
            newProduct.Price       = price;

            if (SharePointService.AddProduct(spContext, newProduct))
            {
                httpCode = new HttpStatusCodeResult(HttpStatusCode.Created);
            }

            return(httpCode);
        }