public ContentManagement FetchResourceCatagory(ContentManagement objContentManagement) { UserManagementLogic obj = new UserManagementLogic(); objContentManagement = obj.FetchResourceCatagory(objContentManagement); return(objContentManagement); }
public ContentManagement RemoveResourceDetails(ContentManagement objContentManagement) { UserManagementLogic obj = new UserManagementLogic(); objContentManagement = obj.DeleteResourceDetails(objContentManagement); return(objContentManagement); }
public void AddContentItemAddsMultipleWithSameContentId() { var content = new ContentManagement(); content.AddContentItem("MyId", "This is a string"); content.AddContentItem("MyId", "This is a string2"); }
public ContentManagement DelResource(ContentManagement objContentManagement) { UserManagementLogic obj = new UserManagementLogic(); objContentManagement = obj.DeleteResource(objContentManagement); return(objContentManagement); }
/// <summary> /// gets the home of BlogEntry module /// </summary> /// <returns>returns the result to action</returns> public ActionResult Index() { SetLabel(); Business.Services.CustomPrincipal currentUserInfo = (Business.Services.CustomPrincipal)User; if (Utils.IsBlogAdmin(currentUserInfo.UserId)) { int mod = 54; int sectionId = 34; ContentManagement objcontentman = new ContentManagement(this.SessionCustom, HttpContext); SectionRepository objsection = new SectionRepository(this.SessionCustom); TemplateRepository objtemplate = new TemplateRepository(this.SessionCustom); objtemplate.Entity.Type = 0; return(this.View(new BlogEntryModel() { UserPrincipal = this.CustomUser, Module = this.Module, ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext), Templates = objtemplate.GetAll().Select(t => t.TemplateId), DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), sectionId), IContent = new Domain.Entities.Content() { ModulId = mod, SectionId = sectionId }, CurrentLanguage = this.CurrentLanguage })); } return(null); }
/// <summary> /// gets the home of report module /// </summary> /// <returns>returns the result to action</returns> public ActionResult Index() { ContentManagement objcontentman = new ContentManagement(this.SessionCustom, HttpContext); SectionRepository objsection = new SectionRepository(this.SessionCustom); TemplateRepository objtemplate = new TemplateRepository(this.SessionCustom); objtemplate.Entity.Type = 0; ContentRepository content = new ContentRepository(SessionCustom); DataTable pulsesTable = content.ReportPulses(); List <SelectListItem> pulses = new List <SelectListItem>(); foreach (DataRow dr in pulsesTable.Rows) { pulses.Add(new SelectListItem() { Value = dr["ContentId"].ToString(), Text = dr["Nombre"].ToString() }); } pulsesTable.Dispose(); ViewBag.Pulses = pulses; return(this.View(new NotificationSettingsModel() { UserPrincipal = this.CustomUser, Module = this.Module, ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext), Templates = objtemplate.GetAll().Select(t => t.TemplateId), CurrentLanguage = this.CurrentLanguage })); }
/// <summary> /// obtains the idea detail /// </summary> /// <param name="mod">identifier of module</param> /// <param name="id">identifier of section</param> /// <returns>returns the result to action</returns> public ActionResult Detail(int mod, int id) { QuestionRepository objquestion = new QuestionRepository(SessionCustom); ContentManagement objcontentman = new ContentManagement(SessionCustom, HttpContext); ContentRepository objcontent = new ContentRepository(SessionCustom); IdeaRepository objidea = new IdeaRepository(SessionCustom); FileattachRepository objfiles = new FileattachRepository(SessionCustom); TagRepository objtag = new TagRepository(SessionCustom); SectionRepository objsection = new SectionRepository(SessionCustom); TemplateRepository objtemplate = new TemplateRepository(SessionCustom); CommentRepository objcomment = new CommentRepository(SessionCustom); objtemplate.Entity.Type = 0; objidea.Entity.IdeaId = objcomment.Entity.IdeaId = id; objidea.LoadByKey(); objquestion.Entity.ContentId = objcontent.Entity.ContentId = objidea.Entity.ContentId; objcontent.LoadByKey(); objquestion.LoadByKey(); if (objquestion.Entity != null && objquestion.Entity.Type.Equals(Domain.Entities.Question.TypeQuestion.Ubicacion)) { ViewBag.Location = true; } else { ViewBag.Location = false; } int totalComments = 0; List <CommentsPaging> comments = objcomment.CommentsPaging(0, 50, out totalComments, id); ViewBag.TotalComments = totalComments; IEnumerable <Tag> SelectedTags = objtag.GetTagbycontent(id); this.ViewBag.SelectedTags = string.Join("|", SelectedTags.Select(t => t.TagId)); this.ViewBag.NewsTags = string.Empty; return(this.View( "Detail", new IdeaModel() { UserPrincipal = this.CustomUser, ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext), Module = this.Module, ListFiles = objfiles.GetAllReadOnly(), Idea = objidea.Entity, IContent = objcontent.Entity, Templates = objtemplate.GetAll().Select(t => t.TemplateId), ListContent = objcontent.GetContentRelation(CurrentLanguage.LanguageId.Value), ListTags = SelectedTags, DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), objcontent.Entity.SectionId.Value), CurrentLanguage = this.CurrentLanguage, ListComments = comments })); }
public async Task <IActionResult> Create([Bind("Id,Name,DisplayName,IsVisible,ItemOrder,Title,Description,AnchorText,AnchorUrl,ImageUrl")] ContentManagement contentManagement, IFormCollection formCollection) { try { if (ModelState.IsValid) { if (formCollection?.Files?.Count > 0) { FileInfo fi = new FileInfo(formCollection.Files[0].FileName); var newFilename = "P" + contentManagement.Id + "_" + string.Format("{0:d}", (DateTime.Now.Ticks / 10) % 100000000) + fi.Extension; var webPath = _hostingEnvironment.WebRootPath; var path = Path.Combine("", webPath + @"\uploads\images\ContentManagement\" + newFilename); var pathToSave = @"/uploads/images/ContentManagement/" + newFilename; using (var stream = new FileStream(path, FileMode.Create)) { formCollection.Files[0].CopyTo(stream); } contentManagement.ImageUrl = pathToSave; } _context.Add(contentManagement); await _context.SaveChangesAsync(); Message = Toast.SucsessToast(); return(RedirectToAction(nameof(Index))); } return(View(contentManagement)); } catch (Exception e) { Message = Toast.ErrorToast(GetExceptionMessage(e)); return(View(contentManagement)); } }
public ActionResult CMSCreate(ContentManagement CMS) { if(!exLogic.User.hasAccess("CMS.CREATE")) return RedirectToAction("NoAccess", "Home"); CMS.CreatedOn = DateTime.Now; CMS.CreatedBy = Util.getLoginUserID(); //Clear any CMSID error genereated if(ModelState.ContainsKey("CmsID")) ModelState["CmsID"].Errors.Clear(); if(!ModelState.IsValid) { return View(CMS); } try { db.ContentManagements.Add(CMS); db.SaveChanges(); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); return View(CMS); } return RedirectToAction("demo", "home", new { id = CMS.CmsRefName }); }
public ContentManagement AddResourceCatagoryDetails(ContentManagement objContentManagement) { UserManagementLogic obj = new UserManagementLogic(); objContentManagement = obj.AddResourceCatagoryDetails(objContentManagement); return(objContentManagement); }
/// <summary> /// gets the home of challenge module /// </summary> /// <param name="mod">identifier of module</param> /// <param name="sectionId">identifier of section</param> /// <returns>returns the result to action</returns> public ActionResult Index(int mod, int?sectionId) { ContentManagement objcontentman = new ContentManagement(this.SessionCustom, HttpContext); SectionRepository objsection = new SectionRepository(this.SessionCustom); TemplateRepository objtemplate = new TemplateRepository(this.SessionCustom); ContentRepository objcontent = new ContentRepository(SessionCustom); TagFacade tagFacade = new TagFacade(); objtemplate.Entity.Type = 0; return(this.View(new ChallengeModel() { UserPrincipal = this.CustomUser, Module = this.Module, ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext), Templates = objtemplate.GetAll().Select(t => t.TemplateId), DeepFollower = sectionId != null ? Business.Utils.GetDeepFollower(objsection.GetAll(), sectionId.Value) : null, IContent = new Domain.Entities.Content() { ModulId = mod, SectionId = sectionId }, CurrentLanguage = this.CurrentLanguage, Categories = objcontent.Categories(), Tags = tagFacade.GetAll().Select(t => new SelectListItem { Text = t.Name, Value = t.TagId.ToString() }) })); }
public ContentManagement AddResourceCatagoryDetails(ContentManagement objContentManagement) { #region Call API objContentManagement = WebApiLogic.GetPostComplexTypeToAPI <ContentManagement>(objContentManagement, "AddResourceCatagoryDetails", "UserManagementData"); #endregion return(objContentManagement); }
public ContentManagement DeleteResource(ContentManagement objContentManagement) { #region Call API objContentManagement = WebApiLogic.GetPostComplexTypeToAPI <ContentManagement>(objContentManagement, "DelResource", "UserManagementData"); #endregion return(objContentManagement); }
public ContentManagement EditResourceContent(ContentManagement objContentManagement) { UserManagementLogic obj = new UserManagementLogic(); objContentManagement = obj.EditResourceContent(objContentManagement); objContentManagement = obj.FetchResource(objContentManagement); return(objContentManagement); }
public JsonResult Deletefile(int id) { ContentManagement objcontent = new ContentManagement(SessionCustom, HttpContext); return(this.Json(new { result = objcontent.DeleteFileAttach(id) })); }
public JsonResult ChangeOrderFile(int fileattachId, int prevId, bool limit) { ContentManagement objcontent = new ContentManagement(SessionCustom, HttpContext); return(this.Json(new { result = objcontent.ChangeOrderFile(fileattachId, prevId, limit) })); }
public void AddContentItemAddsContentToCms() { var content = new ContentManagement(); content.AddContentItem("MyId", "This is a string"); Assert.AreEqual(1, content.CountContentItems); Assert.AreEqual("This is a string", content.RetrieveContentItem("MyId")); }
public JsonResult ChangeSection(int contentId, int sectionId) { ContentManagement objcontent = new ContentManagement(SessionCustom, HttpContext); return(this.Json(new { result = objcontent.ChangeSection(contentId, sectionId) })); }
public JsonResult UpdateFile(int fileattachId, string name) { ContentManagement objcontent = new ContentManagement(SessionCustom, HttpContext); return(this.Json(new { result = objcontent.UpdateFile(fileattachId, name) })); }
public JsonResult DeleteContent(string listContentId) { string[] listofIds = listContentId.Split(','); ContentManagement objcontent = new ContentManagement(SessionCustom, HttpContext); objcontent.DeleteContent(listofIds); return(this.Json(new { result = true }, JsonRequestBehavior.AllowGet)); }
public JsonResult DettachAjax(int id, int contentId) { ContentManagement objcontent = new ContentManagement(SessionCustom, HttpContext); return(this.Json( new { result = objcontent.AttachDettachContent(contentId, id, false) })); }
public void ExistsCompressedReturnsTrueForItemsThatExist() { var content = new ContentManagement(true); content.AddContentItem("MyId", "This is a string"); content.AddContentItem("MyId2", "This is a string2"); Assert.AreEqual(2, content.CountContentItems); Assert.IsTrue(content.Exists("MyId")); Assert.IsTrue(content.Exists("MyId2")); }
public void RetrieveContentItemGetsItemsFromCms() { var content = new ContentManagement(); content.AddContentItem("MyId", "This is a string"); content.AddContentItem("MyId2", "This is a string2"); Assert.AreEqual(2, content.CountContentItems); Assert.AreEqual("This is a string", content.RetrieveContentItem("MyId")); Assert.AreEqual("This is a string2", content.RetrieveContentItem("MyId2")); }
public void AddCompressedContentItemAddsMultipleContentItemsToCms() { var content = new ContentManagement(true); content.AddContentItem("MyId", "This is a string"); content.AddContentItem("MyId2", "This is a string2"); Assert.AreEqual(2, content.CountContentItems); Assert.AreEqual("This is a string", content.RetrieveContentItem("MyId")); Assert.AreEqual("This is a string2", content.RetrieveContentItem("MyId2")); }
public async Task <IActionResult> Edit(int id, ContentManagement contentManagement, IFormCollection formCollection) { if (id != contentManagement.Id) { return(NotFound()); } if (ModelState.IsValid) { try { if (formCollection?.Files?.Count > 0) { var webPath = _hostingEnvironment.WebRootPath; var pathToDelete = webPath + contentManagement.ImageUrl; // TO DO: remove file /* * */ // get File name FileInfo fi = new FileInfo(formCollection.Files[0].FileName); var newFilename = "P" + contentManagement.Id + "_" + string.Format("{0:d}", (DateTime.Now.Ticks / 10) % 100000000) + fi.Extension; var path = Path.Combine("", webPath + @"\uploads\images\ContentManagement\" + newFilename); var pathToSave = @"/uploads/images/ContentManagement/" + newFilename; if (contentManagement.ImageUrl != pathToSave) { using (var stream = new FileStream(path, FileMode.Create)) { formCollection.Files[0].CopyTo(stream); } contentManagement.ImageUrl = pathToSave; } } _context.Update(contentManagement); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ContentManagementExists(contentManagement.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(contentManagement)); }
public void ExistsReturnsFalseForItemsThatDoNotExist() { var content = new ContentManagement(); content.AddContentItem("MyId", "This is a string"); content.AddContentItem("MyId2", "This is a string2"); Assert.AreEqual(2, content.CountContentItems); Assert.IsFalse(content.Exists("not exist")); Assert.IsFalse(content.Exists("not exist 2")); }
public ContentManagement FetchResourceCatagoryDetails(ContentManagement objContentManagement) { UserManagementLogic obj = new UserManagementLogic(); objContentManagement = obj.FetchResourceCatagoryMaster(objContentManagement); if (objContentManagement.ResourceID != 0) { objContentManagement = obj.FetchResource(objContentManagement); } return(objContentManagement); }
/// <summary> /// obtains the challenge detail /// </summary> /// <param name="mod">identifier of module</param> /// <param name="id">identifier of section</param> /// <param name="sectionId">seccion del molulo</param> /// <returns>returns the result to action</returns> public ActionResult Detail(int mod, int id, int?sectionId) { ContentManagement objcontentman = new ContentManagement(SessionCustom, HttpContext); ContentRepository objcontent = new ContentRepository(SessionCustom); SuccessStoryRepository objSuccessStory = new SuccessStoryRepository(SessionCustom); FileattachRepository objfiles = new FileattachRepository(SessionCustom); TagRepository objtag = new TagRepository(SessionCustom); SectionRepository objsection = new SectionRepository(SessionCustom); TemplateRepository objtemplate = new TemplateRepository(SessionCustom); CommentRepository objcomment = new CommentRepository(SessionCustom); TagFacade tagFacade = new TagFacade(); objtemplate.Entity.Type = 0; objSuccessStory.Entity.ContentId = objfiles.Entity.ContentId = objcomment.Entity.ContentId = objcontent.Entity.ContentId = id; objSuccessStory.LoadByKey(); objcontent.LoadByKey(); int totalComments = 0; List <CommentsPaging> comments = objcomment.CommentsPagingContent(0, 50, out totalComments, id); ViewBag.TotalComments = totalComments; IEnumerable <Tag> SelectedTags = objtag.GetTagbycontent(id); this.ViewBag.SelectedTags = string.Join("|", SelectedTags.Select(t => t.TagId)); this.ViewBag.NewsTags = string.Empty; return(this.View( "Index", new SuccessStoryModel() { UserPrincipal = this.CustomUser, ColModul = CustomMemberShipProvider.GetModuls(this.CustomUser.UserId, this.SessionCustom, HttpContext), Module = this.Module, ListFiles = objfiles.GetAllReadOnly(), SuccessStory = objSuccessStory.Entity, IContent = objcontent.Entity, Templates = objtemplate.GetAll().Select(t => t.TemplateId), ListContent = objcontent.GetContentRelation(CurrentLanguage.LanguageId.Value), ListTags = SelectedTags, DeepFollower = Business.Utils.GetDeepFollower(objsection.GetAll(), objcontent.Entity.SectionId.Value), CurrentLanguage = this.CurrentLanguage, ListComments = comments, Tags = tagFacade.GetAll().Select(t => new SelectListItem { Text = t.Name, Value = t.TagId.ToString() }) })); }
// GET: Default public ActionResult Index() { Stopwatch watch = new Stopwatch(); watch.Start(); ContentManagement service = new ContentManagement(); service.GetContent(); service.GetNumber(); watch.Stop(); ViewBag.Milliseconds = watch.ElapsedMilliseconds; return(View()); }
public ActionResult Dettach(int id, int contentId, string name) { ContentManagement objcontent = new ContentManagement(SessionCustom, HttpContext); objcontent.AttachDettachContent(contentId, id, false); return(this.RedirectToAction( "ContentRelation", new { ContentId = contentId, name = name })); }
public IEnumerable<MenuItem> BuildMenu(ContentManagement.IContent menu) { return new MenuItem[] { }; }
public string GetNextPosition(ContentManagement.IContent menu) { return string.Empty; }
public bool TryCheckAccess(Permissions.Permission permission, IUser user, ContentManagement.IContent content) { return true; }
public void CheckAccess(Permissions.Permission permission, IUser user, ContentManagement.IContent content) { }