コード例 #1
0
        protected bool IsServiceEnabled()
        {
            _repository = new ODataServicesRepository();
            ODataServices oDataServices = _repository.GetODataServices();

            return(oDataServices.EnableODataServices);
        }
コード例 #2
0
    // Edit Record
    public void EditODataServices(ODataServices cp)
    {
        XElement node = ODataServicesData.Root.Elements("Settings").FirstOrDefault();

        node.SetElementValue("EnableODataServices", cp.EnableODataServices == false ? false : cp.EnableODataServices);
        ODataServicesData.Save(HttpContext.Current.Server.MapPath("~/App_Data/AdminSettings.xml"));
    }
 public void DisposeOfExistingModel <TAnyModel>(ODataServices <TAnyModel> services, TAnyModel model) where TAnyModel : ISitefinityContentDto
 {
     if (model.Id.HasValue && services.GetItem(model.Id.Value).RestResponse.StatusCode == HttpStatusCode.OK)
     {
         services.Delete(model.Id.Value);
     }
 }
コード例 #4
0
 // GET: ODataServices
 public ActionResult Index()
 {
     if (((CustomPrincipal)User).IsAdmin)
     {
         ODataServices cp = _repository.GetODataServices();
         if (cp == null)
         {
             return(RedirectToAction("Index"));
         }
         return(View(cp));
     }
     else
     {
         return(RedirectToAction("Index", "Home"));
     }
 }
コード例 #5
0
 public ActionResult Edit(bool?EnableODataServices)
 {
     if (((CustomPrincipal)User).IsAdmin)
     {
         if (ModelState.IsValid)
         {
             try
             {
                 ODataServices oDataServices = new ODataServices();
                 oDataServices.EnableODataServices = EnableODataServices == true ? true : false;
                 _repository.EditODataServices(oDataServices);
                 return(RedirectToAction("Index", "Admin"));
             }
             catch (Exception ex)
             {
                 ModelState.AddModelError("", "Error editing record. " + ex.Message);
             }
         }
     }
     return(RedirectToAction("Index", "Home"));
 }