/// <summary> /// Delete a story /// </summary> /// <param name="success">SuccessStory</param> public void DeleteSuccessStory(SuccessStory success) { if (success == null) throw new ArgumentNullException("success"); if (success.Deleted) return; _successStoryRepository.Delete(success); }
private SuccessStoryModel PrepareSuccessStoryModel(SuccessStory successStory) { var model = new SuccessStoryModel(); if (successStory != null) model = successStory.ToModel(); model.Authors = _userService.GetAllUsers().Select(u => u.ToModel()).ToList(); return model; }
private SuccessStoryModel PrepareListSuccessStoryModel(SuccessStory successStory) { var model = successStory.ToModel(); model.Actions.Add(new ModelActionLink { Alt = "Edit", Icon = Url.Content("~/Areas/Admin/Content/images/icon-edit.png"), Target = Url.Action("edit", new { id = successStory.Id }) }); model.Actions.Add(new DeleteActionLink(successStory.Id, Search, Page)); return model; }
public static SuccessStory ToEntity(this SuccessStoryModel model) { if (model == null) return null; var entity = new SuccessStory { Title = model.Title, ShortSummary = model.ShortSummary, Article = model.Article, MetaTitle = model.MetaTitle, MetaDescription = model.MetaDescription, MetaKeywords = model.MetaKeywords, }; return entity; }
/// <summary> /// Insert a category /// </summary> /// <param name="success">SuccessStory</param> public void InsertSuccessStory(SuccessStory success) { if (success == null) throw new ArgumentNullException("success"); success.CreatedBy = _workContext.CurrentUser.Id; success.CreatedDate = DateTime.Now; success.Deleted = false; success.LastModifiedBy = _workContext.CurrentUser.Id; success.LastModifiedDate = DateTime.Now; _successStoryRepository.Insert(success); }
/// <summary> /// Updates the category /// </summary> /// <param name="success">SuccessStory</param> public void UpdateSuccessStory(SuccessStory success) { if (success == null) throw new ArgumentNullException("success"); success.LastModifiedBy = _workContext.CurrentUser.Id; success.LastModifiedDate = DateTime.Now; _successStoryRepository.Update(success); }
private void InstallSuccessStories() { var story = new SuccessStory { Active = true, Article = "Congratulations, you've successfully installed #wewillgather. You can delete this post and add your own new ones via the site admin area.", Author = _userService.GetSiteOwner(), CreatedBy = 1, CreatedDate = DateTime.Now, Deleted = false, LastModifiedDate = DateTime.Now, Title = "You've installed #wewillgather!" }; _successStoryRepository.Insert(story); var storyImage = new Media { EntityId = story.Id, EntityType = EntityType.SuccessStory, FileName = "install-post.jpg", FileType = FileType.Image, UploadedById = 1, UploadedDate = DateTime.Now }; _mediaRepository.Insert(storyImage); }