public async Task <IActionResult> Index(SearchSortAndFilterModel model) { (int filteredUsersCount, var modelUsers) = await this.users .AllAsync <AdminUserListingModel>(model.Page, model.SortBy, model.SortType, model.SearchType, model.SearchText, model.Filter); var tableDataModel = new AdminUsersListingTableModel { Users = modelUsers, LockDays = GetDropDownLockedDaysOptions() }; var pagesModel = new PagesModel { ItemsOnPage = UsersOnPage, CurrentPage = model.Page, TotalItems = filteredUsersCount, SortBy = model.SortBy, SortType = model.SortType, SearchType = model.SearchType, SearchText = model.SearchText, Filter = model.Filter }; var viewModel = new AdminUsersListingViewModel { TableDataModel = tableDataModel, PagesModel = pagesModel, FilterByOptions = GetDropDownFilterUsersOptions(), }; return(this.View(viewModel)); }
public ActionResult Edit(PagesModel input) { if (ModelState.IsValid) { var entity = new tb_Contents(); entity.CategoryId = input.CategoryId; entity.Content = input.Content; entity.Date = input.Date; entity.Description = input.Description; entity.Id = input.Id; entity.Meta_Description = input.Meta_Description; entity.Meta_Keyword = input.Meta_Keyword; entity.Meta_Title = input.Meta_Title; entity.Modified = input.Modified; entity.Name = input.Name; entity.Order = input.Order; entity.ParentId = input.ParentId; entity.Slug = input.Slug; entity.Status = input.Status; entity.Taxonomy = input.Taxonomy; entity.Thumbnail = input.Thumbnail; entity.Title = input.Title; entity.UserId = input.UserId; entity.View = input.View; entity.Modified = Convert.ToDateTime(input.Modified); Dao.Update(entity); } ViewBag.ParentId = new SelectList(Dao.ListAllByTaxonomy("Page"), "Id", "Title", input.ParentId); return(View(input)); }
public ActionResult Pages(PagesModel model) { // Ejecuta acciones if (model != null && !string.IsNullOrWhiteSpace(model.Action)) { switch (model.Action.ToLower().Replace("action-", string.Empty)) { case "add-folder": PagesManager.AddFolder(model.Path, model.Title, model.ParentId); break; case "add-page": PagesManager.AddPage(model.Path, model.Title, model.LayoutId, model.ParentId); break; case "remove-page": PagesManager.RemovePage(model.Path); break; default: break; } } model.Navigation = PagesManager.ReadNavigationNodes(); model.Layouts = GetLayoutsCombo(); return(View(model)); }
public async Task <IActionResult> CreatePage([FromBody] PagesModel model) { try { var pageWithService = await Service.GetPageByServiceId(model.ServiceId); if (pageWithService != null) { return(BadRequest(new ResponseViewModel <bool> { Data = false, Message = TazzerCleanConstants.ServicePageExists })); } var res = await Service.Create(model, currentUsers.Id); return(Ok(new ResponseViewModel <bool> { Data = res, Message = res ? TazzerCleanConstants.SavedSuccess : TazzerCleanConstants.GeneralError })); } catch (Exception ex) { return(Ok(ex)); } }
public ActionResult UserActivate(Guid id) { BusinessLayerResult <User> businessLayerResult = _loginService.ActivateUser(id); if (businessLayerResult.Error.Count > 0) { PagesModel pagesModel = new PagesModel(); pagesModel.Header = "Info"; pagesModel.Items = businessLayerResult.Error; pagesModel.Url = "/Home/Index"; return(View("InfoViewPage", pagesModel)); } else { PagesModel pagesModel = new PagesModel(); pagesModel.Header = "Success"; pagesModel.Items = new List <MessagesObj> { new MessagesObj { codes = MessagesCodes.Success, Messages = "İşlem Başarılı." } }; pagesModel.Url = "/Home/Index"; return(View("InfoViewPage", pagesModel)); } }
public async Task <bool> Create(PagesModel model, Guid userId) { var data = await _pagesRepository.GetByServiceId(model.ServiceId); if (data != null) { return(false); } DataContracts.Entities.Pages page = new DataContracts.Entities.Pages { PageTitle = model.PageTitle, PageImage = model.PageImage, Template = model.Template, CreatedBy = userId, IsActive = model.IsActive, ServiceId = model.ServiceId }; page.Sections = JsonConvert.SerializeObject(model.Sections); await _pagesRepository.CreatePage(page); return(true); }
public ActionResult Pages() { PagesModel model = new PagesModel(); model.Navigation = PagesManager.ReadNavigationNodes(); model.Layouts = GetLayoutsCombo(); return(View(model)); }
public virtual ActionResult ManagePages(string id) { PagesModel model = null; ViewBag.text = "Click here to add content"; _objuser = new UserPresenter(); if (!string.IsNullOrEmpty(id)) { model = _objuser.GetContent(long.Parse(id)); } return(View(model)); }
public virtual ActionResult About(long?id) { _objuser = new UserPresenter(); var model = new PagesModel(); if (id.HasValue) { model = _objuser.GetContent(id.Value); } SessionManager.NewsEventsList = _objuser.GetnewseventsList(); return(View(model)); }
public IHttpActionResult Get(int id) { try { PagesModel page = _pagesService.GetAsync(id).Result; return(Ok(page)); } catch (Exception ex) { return(InternalServerError(ex)); } }
public Task UpdateAsync(PagesModel model) { if (model == null) { throw new ArgumentNullException("PagesModel ArgumentNullException Insert Async"); } Pages dto = AutoMapperGenericHelper <PagesModel, Pages> .Convert(model); _pagesRepository.Update(dto); return(Task.FromResult <object>(null)); }
public Task <PagesModel> GetAsync(int id) { var dal = _pagesRepository.Get(id); if (dal == null) { return(Task.FromResult <PagesModel>(null)); } else { PagesModel model = AutoMapperGenericHelper <Pages, PagesModel> .Convert(dal); return(Task.FromResult(model)); } }
public BaseController() { ViewData["all_products"] = new ProductsModel(); ViewData["blogs"] = new BlogsModel(); ViewData["collections"] = new CollectionsModel(); ViewData["linklists"] = new LinklistsModel(); ViewData["pages"] = new PagesModel(); ViewData["settings"] = new SettingsModel(); ViewData["theme"] = new ThemeModel(); ViewData[ContextKey.SITE_CONFIG] = InitSiteConfiguration(); var contentForHeaderBuilder = new ContentForHeaderBuilder(); ViewData["content_for_header"] = contentForHeaderBuilder.Render(); //ViewData["request.host"] = Request.Url.Host; }
public bool UpdateContent(PagesModel pagecontent) { var objpages = new Page { MetaKeywords = pagecontent.MetaKeywords, ModifiedDate = DateTime.Now, CreateDate = DateTime.Now, Tittle = pagecontent.Tittle, Description = pagecontent.Description, PageCotent = pagecontent.PageCotent, Id = pagecontent.Id, IsActive = true }; return(_objRepository.UpdateContent(objpages)); }
public async Task <IActionResult> UpdatePage([FromBody] PagesModel model) { try { var res = await Service.Update(model, currentUsers.Id); return(Ok(new ResponseViewModel <bool> { Data = res, Message = res ? TazzerCleanConstants.SavedSuccess : TazzerCleanConstants.GeneralError })); } catch (Exception ex) { return(Ok(ex)); } }
public int Put(int id, [FromBody] PagesModel page) { var result = PagesRepository.Get(id); if (result != null) { var resultId = PagesRepository.NewPage(page.ListID, page.Title); return(resultId); } else { PagesRepository.UpdatePage(id, page.Title); } return(0); }
public IHttpActionResult Post(PagesModel model) { try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _pagesService.InsertAsync(model); return(Ok()); } catch (Exception ex) { return(InternalServerError(ex)); } }
public ActionResult Add(PagesModel input) { if (ModelState.IsValid) { input.UserId = SessionHelper.GetSessionUser().UserId; input.Taxonomy = "Page"; input.Status = true; input.View = input.View ?? 0; input.Order = input.Order ?? 0; input.Date = input.Date ?? DateTime.Now; input.Modified = input.Modified ?? DateTime.Now; var entity = new tb_Contents(); entity.CategoryId = input.CategoryId; entity.Content = input.Content; entity.Date = input.Date; entity.Description = input.Description; entity.Id = input.Id; entity.Meta_Description = input.Meta_Description; entity.Meta_Keyword = input.Meta_Keyword; entity.Meta_Title = input.Meta_Title; entity.Modified = input.Modified; entity.Name = input.Name; entity.Order = input.Order; entity.ParentId = input.ParentId; entity.Slug = input.Slug; entity.Status = input.Status; entity.Taxonomy = input.Taxonomy; entity.Thumbnail = input.Thumbnail; entity.Title = input.Title; entity.UserId = input.UserId; entity.View = input.View; long Id = Dao.Insert(entity); return(RedirectToAction("Edit", "Pages", new { Id = Id })); } ViewBag.ParentId = new SelectList(Dao.ListAllByTaxonomy("Page"), "Id", "Title", input.ParentId); return(View(input)); }
public async Task UpdatePage(PagesModel pages) { using IDbConnection _connection = new SqlConnection(_config.GetConnectionString("TazzerCleanCs")); _connection.Open(); var Sections = JsonConvert.SerializeObject(pages.Sections); var procedure = "uspPages_Update"; var reader = await _connection.ExecuteAsync( procedure, new { pages.Id, pages.PageTitle, Sections, pages.PageImage, pages.Template, pages.IsActive, pages.ServiceId }, commandType : CommandType.StoredProcedure, commandTimeout : 10); }
public ActionResult Edit(long?Id) { if (Id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var entity = Dao.Detail(Id); if (entity == null) { return(HttpNotFound()); } var ouput = new PagesModel(); ouput.CategoryId = entity.CategoryId; ouput.Content = entity.Content; ouput.Date = entity.Date; ouput.Description = entity.Description; ouput.Id = entity.Id; ouput.Meta_Description = entity.Meta_Description; ouput.Meta_Keyword = entity.Meta_Keyword; ouput.Meta_Title = entity.Meta_Title; ouput.Modified = Convert.ToDateTime(entity.Modified); ouput.Name = entity.Name; ouput.Order = entity.Order; ouput.ParentId = entity.ParentId; ouput.Slug = entity.Slug; ouput.Status = entity.Status; ouput.Taxonomy = entity.Taxonomy; ouput.Thumbnail = entity.Thumbnail; ouput.Title = entity.Title; ouput.UserId = entity.UserId; ouput.View = entity.View; ViewBag.ParentId = new SelectList(Dao.ListAllByTaxonomy("Page"), "Id", "Title", entity.ParentId); return(View(ouput)); }
public virtual ActionResult ManagePages(PagesModel pagedetails, string myArea1, FormCollection form) { try { if (ModelState.IsValid) { _objuser = new UserPresenter(); pagedetails.IsActive = true; _objuser.AddContent(pagedetails); return(RedirectToAction(MVC.Admin.ViewPagesGrid())); } else { string message = "Inavlid data"; ModelState.AddModelError("", message); } } catch (Exception ex) { return(View()); } return(RedirectToAction("ManagePages")); }
public async Task <IActionResult> OnGetPageData(PagesModel entity) => new JsonResult(await PagePluginManager.Instance.GetPageDataAsync(entity));
public async Task <IActionResult> OnPostAddAndEditExc(PagesModel entity) => new JsonResult(await PagePluginManager.Instance.OperationAsync(entity));
/// <summary> /// 初始化模块资源 /// </summary> private void InitPages() { //1、根据权限获取节点名称,并绑定左侧树 //2、根据节点名称从容器中获取树对象 string path = AppDomain.CurrentDomain.BaseDirectory + "Images\\devexpress\\"; AccordionControlElement accordionControlElement = new AccordionControlElement(); accordionControlElement.Text = "系统参数"; accordionControlElement.Style = ElementStyle.Group; accordionControl.Elements.Add(accordionControlElement); accordionControlElement.Image = Image.FromFile(path + "customizegrid_32x32.png"); AccordionControlElement childElement = new AccordionControlElement(); childElement.Text = "系统参数"; childElement.Name = "XucSystemSet"; childElement.Style = ElementStyle.Item; childElement.Image = Image.FromFile(path + "scripts_16x16.png"); //TODO 模块图标 accordionControlElement.Elements.Add(childElement); PagesModel pagesModel = new PagesModel(); if (FromsObject.formsDic.ContainsKey("XucSystemSet")) { pagesModel.PageName = "XucSystemSet"; pagesModel.PageText = "系统参数"; accordionControl.Name = ""; pagesModel.xtraUserControl = FromsObject.formsDic["XucSystemSet"]; listUserControl.Add(pagesModel); } #region 此处的代码可以从数据库的模块管理表中查询并赋值 //1、先取分组信息 //2、根据分组信息,取节点并添加到分组内 AccordionControlElement accordionControlElement1 = new AccordionControlElement(); accordionControlElement1.Text = "称重计量"; accordionControlElement1.Style = ElementStyle.Group; accordionControl.Elements.Add(accordionControlElement1); accordionControlElement1.Image = Image.FromFile(path + "addnewdatasource_32x32.png"); AccordionControlElement childElement1 = new AccordionControlElement(); childElement1.Text = "集中计量"; childElement1.Name = "XucFocusWeight"; childElement1.Style = ElementStyle.Item; childElement1.Image = Image.FromFile(path + "addheader_16x16.png"); //TODO 模块图标 //childElement1.Image = ""; accordionControlElement1.Elements.Add(childElement1); if (FromsObject.formsDic.ContainsKey("XucFocusWeight")) { pagesModel = new PagesModel(); pagesModel.PageName = "XucFocusWeight"; pagesModel.PageText = "集中计量"; pagesModel.xtraUserControl = FromsObject.formsDic["XucFocusWeight"]; listUserControl.Add(pagesModel); } #endregion }
public int Post([FromBody] PagesModel page) { var id = PagesRepository.NewPage(page.ListID, page.Title); return(id); }
public async Task <bool> Update(PagesModel model, Guid userId) { await _pagesRepository.UpdatePage(model); return(true); }