public ActionResult Update(Customer model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var exitsData = "";

            if (model != null && !CUtils.IsNullOrEmpty(model.CustomerId))
            {
                var customs = CustomerManager.Get(new Customer()
                {
                    CustomerId = model.CustomerId
                });
                if (customs != null)
                {
                    CustomerManager.Update(model, customs);
                    resultEntry.Success = true;
                    resultEntry.AddMessage("Cập nhật khách hàng thành công!");
                    resultEntry.RedirectUrl = Url.Action("Search", "Customer", new { area = "Auth" });
                }
                else
                {
                    resultEntry.Success = true;
                    exitsData           = "Mã danh mục '" + model.CustomerId + "' không có trong hệ thống!";
                }
            }
            else
            {
                resultEntry.Success = true;
                exitsData           = "Mã danh mục trống!";
            }
            resultEntry.AddMessage(exitsData);
            return(Json(resultEntry));
        }
Esempio n. 2
0
        public ActionResult Create(News model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };

            if (model != null)
            {
                model.Language     = Culture;
                model.NewShortName = model.NewTitle.ToUrlSegment(250).ToLower();
                var createBy = "";
                if (UserState != null && !CUtils.IsNullOrEmpty(UserState.UserName))
                {
                    createBy = CUtils.StrTrim(UserState.UserName);
                }
                model.CreateBy      = createBy;
                resultEntry.Success = true;
                resultEntry.AddMessage("Tạo mới  tin tức thành công!");
                resultEntry.RedirectUrl = Url.Action("Create", "News", new { area = "Auth" });
            }
            else
            {
                resultEntry.Detail = "dư lieu null";
            }
            return(Json(resultEntry));
        }
Esempio n. 3
0
        public ActionResult Create(Slide model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };

            if (model != null)
            {
                var createBy = "";
                model.Language = Culture;
                if (UserState != null && !CUtils.IsNullOrEmpty(UserState.UserName))
                {
                    createBy = CUtils.StrTrim(UserState.UserName);
                }
                model.CreateBy = createBy;
                SlideManager.Add(model);
                resultEntry.Success = true;
                resultEntry.AddMessage("Tạo mới Side thành công!");
                resultEntry.RedirectUrl = Url.Action("Create", "Slide", new { area = "Auth" });
            }
            else
            {
                resultEntry.Detail = "dư lieu null";
            }
            return(Json(resultEntry));
        }
        public ActionResult Create(Location model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };

            if (model != null)
            {
                var createBy = "";
                if (UserState != null && !CUtils.IsNullOrEmpty(UserState.UserName))
                {
                    createBy = CUtils.StrTrim(UserState.UserName);
                }
                model.CreateBy      = createBy;
                model.LocationValue = model.LocationName.ToUrlSegment(250).ToLower();
                model.Culture       = Culture;

                ServiceFactory.LocationManager.Add(model);
                resultEntry.Success = true;
                resultEntry.AddMessage("Tạo mới quận/huyện thành công!");
                resultEntry.RedirectUrl = Url.Action("Create", "Location", new { area = "Auth", locationDiscountId = model.LocationDiscountId });
            }
            else
            {
                resultEntry.Detail = "dư lieu null";
            }
            return(Json(resultEntry));
        }
Esempio n. 5
0
        public override ActionResult Edit(CMS.Sites.Models.View newModel, string old_key)
        {
            JsonResultEntry entry = new JsonResultEntry();
            try
            {
                if (ModelState.IsValid)
                {
                    newModel.UserName = User.Identity.Name;
                    Update(newModel, old_key);
                    var pageRedirect = Request.Form["pageRedirect"];
                    entry.AddMessage("The item has been saved.".Localize()).SetSuccess().RedirectUrl = string.Equals(pageRedirect, "true", StringComparison.OrdinalIgnoreCase) ? this.Url.Action("Index", this.ControllerContext.RequestContext.AllRouteValues()) : null;

                }
                else
                {
                    entry.AddModelState(ModelState);
                }
            }
            catch (Exception e)
            {
                entry.AddException(e);
            }

            return Json(entry);
        }
Esempio n. 6
0
        public virtual ActionResult Draft(Page newModel, string old_key, bool?preview, bool?published)
        {
            JsonResultEntry result = new JsonResultEntry();

            try
            {
                newModel.Site = Site;

                var old = Manager.Get(Site, old_key);

                SavePosition(newModel);

                newModel.Published = false;
                newModel.UserName  = User.Identity.Name;
                Manager.PageProvider.SaveAsDraft(newModel);

                if (published.HasValue && published.Value == true)
                {
                    Manager.Publish(old, true, User.Identity.Name);

                    result.RedirectUrl = GetReturnUrl();
                }
                result.AddMessage("The item has been saved.".Localize());
            }
            catch (Exception e)
            {
                result.AddException(e);
            }

            return(Json(result));
        }
        public ActionResult Create(Manufacters model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };

            if (model != null)
            {
                var createBy = "";
                if (UserState != null && !CUtils.IsNullOrEmpty(UserState.UserName))
                {
                    createBy = CUtils.StrTrim(UserState.UserName);
                }
                model.CreateBy          = createBy;
                model.ManufactShortName = model.ManufactName.ToUrlSegment(250).ToLower();
                model.Culture           = Culture;

                ServiceFactory.ManufacterManager.Add(model);
                resultEntry.Success = true;
                resultEntry.AddMessage("Tạo mới nhà sản xuất thành công!");
                resultEntry.RedirectUrl = Url.Action("Create", "Manufacter", new { area = "Auth" });
            }
            else
            {
                resultEntry.Detail = "dư lieu null";
            }
            return(Json(resultEntry));
        }
        public ActionResult Update(Sys_User model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var exitsData = "";

            if (model != null && !CUtils.IsNullOrEmpty(model.UserCode))
            {
                var sysUser = Sys_UserManager.Get(new Sys_User()
                {
                    UserCode = model.UserCode
                });
                if (sysUser != null)
                {
                    var updateBy = "";
                    if (UserState != null && !CUtils.IsNullOrEmpty(UserState.UserName))
                    {
                        updateBy = CUtils.StrTrim(UserState.UserName);
                    }
                    model.UpdateBy   = updateBy;
                    model.IsSysAdmin = sysUser.IsSysAdmin; // Không update cờ SysAdmin
                    Sys_UserManager.Update(model, sysUser);
                    resultEntry.Success = true;
                    resultEntry.AddMessage("Cập nhật người dùng thành công!");
                    resultEntry.RedirectUrl = Url.Action("Index", "Sys_User", new { area = "Auth" });
                }
                else
                {
                    resultEntry.Success = true;
                    exitsData           = "Mã người dùng '" + model.UserCode + "' không có trong hệ thống!";
                }
            }
            else
            {
                resultEntry.Success = true;
                exitsData           = "Mã người dùng trống!";
            }
            resultEntry.AddMessage(exitsData);

            return(Json(resultEntry));
        }
        public ActionResult Update(Location model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var exitsData = "";

            if (model != null && !CUtils.IsNullOrEmpty(model.LocationId))
            {
                var News = LocationManager.Get(new Location()
                {
                    LocationId = model.LocationId
                });
                if (News != null)
                {
                    var updateBy = "";
                    if (UserState != null && !CUtils.IsNullOrEmpty(UserState.UserName))
                    {
                        updateBy = CUtils.StrTrim(UserState.UserName);
                    }
                    model.LocationValue = model.LocationName.ToUrlSegment(250).ToLower();

                    LocationManager.Update(model, News);
                    resultEntry.Success = true;
                    resultEntry.AddMessage("Cập nhật quận/huyện thành công!");
                    resultEntry.RedirectUrl = Url.Action("Index", "Location", new { locationDiscountId = model.LocationDiscountId });
                }
                else
                {
                    resultEntry.Success = true;
                    exitsData           = "Mã quận/huyện '" + model.LocationId + "' không có trong hệ thống!";
                }
            }
            else
            {
                resultEntry.Success = true;
                exitsData           = "Mã quận/huyện trống!";
            }
            resultEntry.AddMessage(exitsData);
            return(Json(resultEntry));
        }
Esempio n. 10
0
        public ActionResult Login(LoginModel model, string returnUrl)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };

            try
            {
                if (Session != null)
                {
                    Session.UserState = null;
                    Session.SessionId = null;
                    Session.Session.Clear();
                }
                var abc = Sys_UserManager.Login(model.UserName, model.Password);
                if (ModelState.IsValid && Membership.ValidateUser(model.UserName, model.Password))
                {
                    FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                    if (CUtils.IsNullOrEmpty(returnUrl) || returnUrl == "/")
                    {
                        var url = Url.ActionLocalized("Index", "Home", new { area = "Auth" });
                        returnUrl = url;
                    }
                    resultEntry.Success          = true;
                    resultEntry.RedirectToOpener = true;
                    resultEntry.RedirectUrl      = returnUrl;
                }
                else
                {
                    var exitsData = "Tên đăng nhập hoặc mật khẩu không hợp lệ!";
                    resultEntry.AddMessage(exitsData);
                }


                return(Json(resultEntry));
                // If we got this far, something failed, redisplay form
                //ModelState.AddModelError("", "The user name or password provided is incorrect.");
                //return View(model);
            }
            catch (ValidationException valEx)
            {
                foreach (var ver in valEx.ValidationErrors)
                {
                    resultEntry.AddFieldError(ver.FieldName, ver.ErrorMessage);
                }
            }
            catch (Exception e)
            {
                resultEntry.SetFailed().AddException(this, e);
            }
            resultEntry.AddModelState(ViewData.ModelState);
            return(Json(resultEntry));
        }
Esempio n. 11
0
        public virtual ActionResult Install(InstallModuleModel installModel)
        {
            JsonResultEntry result = new JsonResultEntry()
            {
                RedirectToOpener = false
            };

            try
            {
                if (ModelState.IsValid)
                {
                    var moduleFile = this.Request.Files["ModuleFile"];
                    if (moduleFile == null || moduleFile.ContentLength == 0)
                    {
                        ModelState.AddModelError("ModuleFile", "ModuleFile is null.");
                    }
                    else
                    {
                        StringBuilder log        = new StringBuilder();
                        var           moduleName = System.IO.Path.GetFileNameWithoutExtension(moduleFile.FileName);

                        var moduleInfo = Manager.Install(moduleName, moduleFile.InputStream, ref log);

                        if (moduleInfo == null && log.Length != 0)
                        {
                            result.Success = false;
                            result.AddMessage(log.ToString());
                        }
                        else
                        {
                            result.RedirectUrl = Url.Action("InstallationCompleted", new { moduleName = moduleInfo.ModuleName });

                            //var moduleInstallUrl = moduleInfo.InstallUrl;
                            //if (string.IsNullOrEmpty(moduleInstallUrl))
                            //{
                            //    result.RedirectUrl = Url.Action("InstallationCompleted", new { moduleName = moduleInfo.ModuleName });
                            //}
                            //else
                            //{
                            //    result.RedirectUrl = Url.Action("InstallScaffold", new { moduleName = moduleInfo.ModuleName, installUrl = moduleInstallUrl });
                            //}
                        }
                    }
                }
            }
            catch (Exception e)
            {
                result.AddException(e);
            }

            result.AddModelState(ModelState);
            return(Json(result));
        }
Esempio n. 12
0
        public override ActionResult Edit(Page newModel, string old_key)
        {
            JsonResultEntry result = new JsonResultEntry();

            try
            {
                newModel.Site     = Site;
                newModel.UserName = User.Identity.Name;

                var old = Manager.Get(Site, old_key);

                SavePosition(newModel);

                var saveAsDraft = this.Request.Form["SaveAsDraft"];

                result.RedirectUrl = GetReturnUrl();

                if (!string.IsNullOrEmpty(saveAsDraft) && saveAsDraft.ToLower() == "true")
                {
                    Manager.PageProvider.SaveAsDraft(newModel);
                    result.Model = new { preview = true };
                    //result.RedirectUrl = Url.Action("Draft", ControllerContext.RequestContext.AllRouteValues());
                }
                else
                {
                    var setPublished = Request.Form["SetPublished"];
                    if (!string.IsNullOrEmpty(setPublished))
                    {
                        var published = false;
                        bool.TryParse(setPublished, out published);
                        newModel.Published = published;
                    }
                    else
                    {
                        result.RedirectUrl = null;
                        result.AddMessage("The item has been saved.".Localize());
                    }
                    Manager.Update(Site, newModel, old);
                }

                if (string.IsNullOrEmpty(result.RedirectUrl))
                {
                    result.Model = FrontUrlHelper.Preview(Url, Kooboo.CMS.Sites.Models.Site.Current, newModel, null).ToString();
                }
            }
            catch (Exception e)
            {
                result.AddException(e);
            }

            return(Json(result));
        }
        public ActionResult Update(Locations model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var exitsData = "";

            if (model != null && !CUtils.IsNullOrEmpty(model.LocationId))
            {
                var locations = LocationManager.Get(new Locations()
                {
                    LocationId = model.LocationId
                });
                if (locations != null)
                {
                    model.LocationValue = model.LocationName.ToUrlSegment(250).ToLower();
                    model.Language      = Culture;
                    LocationManager.Update(model, locations);
                    resultEntry.Success = true;
                    resultEntry.AddMessage("Cập nhật thuộc tính thành công !");
                    resultEntry.RedirectUrl = Url.Action("Index", "Location", new { area = "Auth", locationDiscountId = model.LocationDiscountId });
                }
                else
                {
                    resultEntry.Success = true;
                    exitsData           = "Mã danh mục '" + model.LocationId + "' không có trong hệ thống!";
                }
            }
            else
            {
                resultEntry.Success = true;
                exitsData           = "Mã danh mục trống!";
            }
            resultEntry.AddMessage(exitsData);
            return(Json(resultEntry));
        }
Esempio n. 14
0
        public ActionResult Update(News model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var exitsData = "";

            if (model != null && !CUtils.IsNullOrEmpty(model.NewsId))
            {
                var cate = NewManager.Get(new News()
                {
                    NewsId = model.NewsId
                });
                if (cate != null)
                {
                    model.Language     = Culture;
                    model.NewShortName = model.NewTitle.ToUrlSegment(250).ToLower();
                    NewManager.Update(model, cate);
                    resultEntry.Success = true;
                    resultEntry.AddMessage("Cập nhật tin tức thành công !");
                    resultEntry.RedirectUrl = Url.Action("Index", "News", new { area = "Auth" });
                }
                else
                {
                    resultEntry.Success = true;
                    exitsData           = "Mã danh mục '" + model.NewsId + "' không có trong hệ thống!";
                }
            }
            else
            {
                resultEntry.Success = true;
                exitsData           = "Mã danh mục trống!";
            }
            resultEntry.AddMessage(exitsData);
            return(Json(resultEntry));
        }
        public ActionResult Update(LocationDiscount model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var exitsData = "";

            if (model != null && !CUtils.IsNullOrEmpty(model.LocationDiscountId))
            {
                var News = LocationDiscountManager.Get(new LocationDiscount()
                {
                    LocationDiscountId = model.LocationDiscountId
                });
                if (News != null)
                {
                    model.LocationDiscountValue = model.LocationDiscountName.ToUrlSegment(250).ToLower();

                    LocationDiscountManager.Update(model, News);
                    resultEntry.Success = true;
                    resultEntry.AddMessage("Cập nhật thông tin thành công!");
                    resultEntry.RedirectUrl = Url.Action("Index", "LocationDiscount", new { area = "Auth" });
                }
                else
                {
                    resultEntry.Success = true;
                    exitsData           = "Mã tỉnh '" + model.LocationDiscountId + "' không có trong hệ thống!";
                }
            }
            else
            {
                resultEntry.Success = true;
                exitsData           = "Mã tỉnh trống!";
            }
            resultEntry.AddMessage(exitsData);
            return(Json(resultEntry));
        }
Esempio n. 16
0
        public ActionResult Update(Manufacters model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var exitsData = "";

            if (model != null && !CUtils.IsNullOrEmpty(model.ManufactId))
            {
                var manu = ManufactersManager.Get(new Manufacters()
                {
                    ManufactId = model.ManufactId
                });
                if (manu != null)
                {
                    model.ManufactShortName = model.ManufactName.ToUrlSegment(250).ToLower();
                    model.Language          = Culture;
                    ManufactersManager.Update(model, manu);
                    resultEntry.Success = true;
                    resultEntry.AddMessage("Cập nhật hãng thành công !");
                    resultEntry.RedirectUrl = Url.Action("Index", "Manufacters", new { area = "Auth" });
                }
                else
                {
                    resultEntry.Success = true;
                    exitsData           = "Mã danh mục '" + model.ManufactId + "' không có trong hệ thống!";
                }
            }
            else
            {
                resultEntry.Success = true;
                exitsData           = "Mã danh mục trống!";
            }
            resultEntry.AddMessage(exitsData);
            return(Json(resultEntry));
        }
        public ActionResult Update(Manufacters model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var exitsData = "";

            if (model != null && !CUtils.IsNullOrEmpty(model.ManufactId))
            {
                var News = ManufacterManager.Get(new Manufacters()
                {
                    ManufactId = model.ManufactId
                });
                if (News != null)
                {
                    model.ManufactShortName = model.ManufactName.ToUrlSegment(250).ToLower();

                    ManufacterManager.Update(model, News);
                    resultEntry.Success = true;
                    resultEntry.AddMessage("Cập nhật thông tin thành công!");
                    resultEntry.RedirectUrl = Url.Action("Index", "Manufacter", new { area = "Auth" });
                }
                else
                {
                    resultEntry.Success = true;
                    exitsData           = "Mã nhà sản xuất '" + model.ManufactId + "' không có trong hệ thống!";
                }
            }
            else
            {
                resultEntry.Success = true;
                exitsData           = "Mã nhà sản xuất trống!";
            }
            resultEntry.AddMessage(exitsData);
            return(Json(resultEntry));
        }
Esempio n. 18
0
        public ActionResult Update(Slide model)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var exitsData = "";

            if (model != null && !CUtils.IsNullOrEmpty(model.SlideBannerId))
            {
                var slide = SlideManager.Get(new Slide()
                {
                    SlideBannerId = model.SlideBannerId
                });
                if (slide != null)
                {
                    model.Language = Culture;
                    SlideManager.Update(model, slide);
                    resultEntry.Success = true;
                    resultEntry.AddMessage("Cập nhật slidebanner thành công !");
                    resultEntry.RedirectUrl = Url.Action("Index", "Slide", new { area = "Auth" });
                }
                else
                {
                    resultEntry.Success = true;
                    exitsData           = "Mã danh mục '" + model.SlideBannerId + "' không có trong hệ thống!";
                }
            }
            else
            {
                resultEntry.Success = true;
                exitsData           = "Mã danh mục trống!";
            }
            resultEntry.AddMessage(exitsData);
            return(Json(resultEntry));
        }
Esempio n. 19
0
        public virtual ActionResult Index(Site model)
        {
            JsonResultEntry resultEntry = new JsonResultEntry(ModelState);

            try
            {
                if (ModelState.IsValid)
                {
                    var site = Site.AsActual();

                    //if (isNew)
                    //{
                    //    CreateRepository(model.Repository);
                    //}

                    site.DisplayName = model.DisplayName;
                    site.Culture     = model.Culture;

                    site.Domains        = model.Domains;
                    site.SitePath       = model.SitePath;
                    site.Mode           = model.Mode;
                    site.Repository     = model.Repository;
                    site.Theme          = model.Theme;
                    site.Version        = model.Version;
                    site.InlineEditing  = model.InlineEditing;
                    site.ShowSitemap    = model.ShowSitemap;
                    site.Smtp           = model.Smtp;
                    site.Security       = model.Security;
                    site.ResourceDomain = model.ResourceDomain;
                    if (site.Smtp != null && site.Smtp.To != null)
                    {
                        site.Smtp.To = site.Smtp.To.Where(it => !string.IsNullOrEmpty(it)).ToArray();
                    }
                    site.CustomFields      = model.CustomFields;
                    site.EnableVersioning  = model.EnableVersioning;
                    site.EnableJquery      = model.EnableJquery;
                    site.EnableStyleEdting = model.EnableStyleEdting;

                    ServiceFactory.SiteManager.Update(site);
                    resultEntry.AddMessage("Site setting has been changed.".Localize());
                }
            }
            catch (Exception e)
            {
                resultEntry.AddException(e);
            }
            return(Json(resultEntry));
        }
Esempio n. 20
0
        public ActionResult Delete(int SlideId)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var news = new Slide()
            {
                SlideBannerId = SlideId
            };

            SlideManager.Remove(news);
            resultEntry.Success = true;
            resultEntry.AddMessage("Xóa slide thành công!");
            return(Json(resultEntry));
        }
        public ActionResult Delete(int locationdiscountid)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var news = new LocationDiscount()
            {
                LocationDiscountId = locationdiscountid
            };

            LocationDiscountManager.Remove(news);
            resultEntry.Success = true;
            resultEntry.AddMessage("Xóa thành phố thành công!");
            return(Json(resultEntry));
        }
        public ActionResult Delete(int manufactId)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var objNews = new Manufacters()
            {
                ManufactId = manufactId
            };

            ManufacterManager.Remove(objNews);
            resultEntry.Success = true;
            resultEntry.AddMessage("Xóa nhà sản xuất thành công!");
            return(Json(resultEntry));
        }
Esempio n. 23
0
        public ActionResult Delete(int locationId)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var objNews = new Location()
            {
                LocationId = locationId
            };

            LocationManager.Remove(objNews);
            resultEntry.Success = true;
            resultEntry.AddMessage("Xóa quận/huyện thành công!");
            return(Json(resultEntry));
        }
Esempio n. 24
0
        public ActionResult Delete(int id)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var news = new Manufacters()
            {
                ManufactId = id
            };

            ManufactersManager.Remove(news);
            resultEntry.Success = true;
            resultEntry.AddMessage("Xóa hãng thành công!");
            return(Json(resultEntry));
        }
        public ActionResult Delete(int CustomerId)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var custom = new Customer()
            {
                CustomerId = CustomerId
            };

            CustomerManager.Remove(custom);
            resultEntry.Success = true;
            resultEntry.AddMessage("Xóa khách hàng thành công!");
            return(Json(resultEntry));
        }
Esempio n. 26
0
        public virtual ActionResult Index(string body)
        {
            JsonResultEntry resultEntry = new JsonResultEntry(ModelState);

            try
            {
                Robots_Txt robot_txt = new Robots_Txt(Site);
                robot_txt.Save(body);
                resultEntry.AddMessage("The robots.txt has been saved.".Localize());
            }
            catch (Exception e)
            {
                resultEntry.AddException(e);
            }
            return(Json(resultEntry));
        }
Esempio n. 27
0
        public ActionResult Delete(string usercode)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var objSys_User = new Sys_User()
            {
                UserCode = usercode
            };

            Sys_UserManager.Remove(objSys_User);
            resultEntry.Success = true;
            resultEntry.AddMessage("Xóa người dùng thành công!");
            return(Json(resultEntry));
        }
Esempio n. 28
0
        public ActionResult Delete(int NewsId)
        {
            var resultEntry = new JsonResultEntry()
            {
                Success = false
            };
            var news = new News()
            {
                NewsId = NewsId
            };

            NewManager.Remove(news);
            resultEntry.Success = true;
            resultEntry.AddMessage("Xóa tin tức thành công!");
            return(Json(resultEntry));
        }
Esempio n. 29
0
        public virtual ActionResult Revert(View view, int version)
        {
            var entry = new JsonResultEntry();

            try
            {
                view.Site = Site;
                Manager.VersiongLogger.Revert(view, version);
                entry.AddMessage("Revert successfully.".Localize());
            }
            catch (Exception e)
            {
                entry.AddException(e);
            }

            return Json(entry);
        }
Esempio n. 30
0
        public virtual ActionResult Revert(string name, int version)
        {
            JsonResultEntry result = new JsonResultEntry();

            try
            {
                var layout = new Layout(Site, name);
                Kooboo.CMS.Sites.Versioning.VersionManager.Revert(layout, version);
                result.AddMessage("Revert successfully.".Localize());
            }
            catch (Exception e)
            {
                result.AddException(e);
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }