// GET: Blog public ActionResult Blog() { BlogRepository blogRepository = new BlogRepository(); BlogPhotoRepository blogPhotoRepository = new BlogPhotoRepository(); BlogCommentRepository blogCommentRepository = new BlogCommentRepository(); UserRepository userRepository = new UserRepository(); List <BlogViewModel> blogView = new List <BlogViewModel>(); var blogresult = blogRepository.GetAll(); var blogphotoresult = blogPhotoRepository.GetAll(); var blogcommentresult = blogCommentRepository.GetAll(); foreach (var item in blogresult) { blogView.Add(new BlogViewModel { Id = item.Id, Content = item.Content, Star = item.Star, Title = item.Title, RegisterDate = item.RegisterDate, UserId = item.UserId, Users = userRepository.GetById(item.UserId), }); } foreach (var item in blogphotoresult) { blogView.ForEach(x => x.Photo = item.Photo); } return(View(blogView)); }
public UnitOfWork(ApplicationDbContext context) { _context = context; ProductDetails = new ReservationDetailsRepository(_context); Products = new ProductRepository(_context); ProductCategories = new ProductCategoryRepository(_context); Services = new ServiceRepository(_context); ServiceCategories = new ServiceCategoryRepository(_context); Departments = new DepartmentRepository(_context); Menus = new MenuRepository(_context); SubMenus = new SubMenuRepository(_context); OurTeams = new OurTeamRepository(_context); Designations = new DesignationRepository(_context); Faq = new FaqRepository(_context); Client = new ClientRepository(_context); Blogs = new BlogRepository(_context); ContactUs = new ContactUsRepository(_context); Companies = new CompanyRepository(_context); Banner = new BannerRepository(_context); ChooseUs = new WhyChooseUsRepository(_context); ClientProducts = new ClientProductRepository(_context); AboutUs = new AboutUsRepository(_context); HostingPlan = new HostingPlanRepository(_context); CustomerReview = new CustomerReviewRepository(_context); Career = new CareerRepository(_context); Job = new JobRepository(_context); Softwares = new SoftwareRepository(_context); SoftwareCategories = new SoftwareCategoriesRepository(_context); Features = new FeaturesRepository(_context); BlogComment = new BlogCommentRepository(_context); QueryHelper = new QueryHelper(); }
public BlogController(BlogRepository blogRepository, BlogService blogService, IMapper mapper, PaginatedMetaService paginatedMetaService, FileHelper fileHelper, BlogCommentRepository blogCommentRepo, BlogCommentService blogCommentService) { _blogRepository = blogRepository; _blogService = blogService; _mapper = mapper; _paginatedMetaService = paginatedMetaService; _fileHelper = fileHelper; _blogCommentRepo = blogCommentRepo; _blogCommentService = blogCommentService; }
public BlogController(BlogRepository blogRepo, BlogService blogService, BlogCommentService blogCommentService, BlogCommentRepository blogCommentRepo, IMapper mapper, PaginatedMetaService paginatedMetaService, EventRepository eventRepo, SetupRepository setupRepo, NoticeRepository noticeRepo) { _blogRepo = blogRepo; _eventRepo = eventRepo; _blogService = blogService; _setupRepo = setupRepo; _mapper = mapper; _blogCommentRepo = blogCommentRepo; _blogCommentService = blogCommentService; _paginatedMetaService = paginatedMetaService; _noticeRepo = noticeRepo; }
// GET: Home public ActionResult Index() { JsonData jsondot = new JsonData(); string json = jsondot.data; using (var client = new HttpClient()) { List <Brand> jsonRequest = JsonConvert.DeserializeObject <List <Brand> >(json); // Gelen Değeri Modele Aktardım List <Brand> brand = jsonRequest; List <string> marka = new List <string>(); foreach (var item in brand) { marka.Add(item.BrandName); } ViewBag.Markalar = marka; } BlogRepository blogRepository = new BlogRepository(); BlogPhotoRepository blogPhotoRepository = new BlogPhotoRepository(); BlogCommentRepository blogCommentRepository = new BlogCommentRepository(); UserRepository userRepository = new UserRepository(); List <BlogViewModel> blogView = new List <BlogViewModel>(); var blogresult = blogRepository.GetAll(); var blogphotoresult = blogPhotoRepository.GetAll(); var blogcommentresult = blogCommentRepository.GetAll(); foreach (var item in blogresult) { blogView.Add(new BlogViewModel { Id = item.Id, Content = item.Content, Star = item.Star, Title = item.Title, RegisterDate = item.RegisterDate, UserId = item.UserId, Users = userRepository.GetById(item.UserId), }); } foreach (var item in blogphotoresult) { blogView.ForEach(x => x.Photo = item.Photo); } ViewData["Blog"] = blogView; return(View()); }
public ActionResult Detail(BlogComment model) { BlogCommentRepository commentRepository = new BlogCommentRepository(); commentRepository.Add(new RCP.Model.BlogComment { Content = model.Content, Title = model.Title, BlogId = model.BlogId, Blogs = model.Blogs, Id = model.Id, IsDelete = false, RegisterDate = DateTime.Now }); return(View()); }
public ActionResult Detail(int id) { BlogRepository blogRepository = new BlogRepository(); BlogPhotoRepository blogPhotoRepository = new BlogPhotoRepository(); BlogCommentRepository blogCommentRepository = new BlogCommentRepository(); BlogDetailViewModel blogView = new BlogDetailViewModel(); var blogresult = blogRepository.GetById(id); var blogphotoresult = blogPhotoRepository.GetByFilter(X => X.BlogId == id); var blogcommentresult = blogCommentRepository.GetByFilter(x => x.BlogId == id); blogView.Content = blogresult.Content; blogView.Star = blogresult.Star; blogView.Title = blogresult.Title; blogView.RegisterDate = blogresult.RegisterDate; blogView.UserId = blogresult.UserId; blogView.Users = blogresult.Users; blogView.blogComment = blogcommentresult; blogView.blogPhoto = blogphotoresult; return(View(blogView)); }
public HttpResponseMessage SubmitComment(HttpRequestMessage request, [FromBody] BlogComment blogComment) { HttpResponseMessage response = null; try { blogComment.Timestamp = DateTime.Now; PreSubmissionCommentEventArgs preArgs = new PreSubmissionCommentEventArgs(blogComment); _ExtensibilityManager.InvokeCancelableModuleEvent <PreSubmissionCommentEventArgs>( _ModuleEvents.PreSubmissionComment, preArgs); if (!preArgs.Cancel) { IBlogCommentRepository blogCommentRepository = new BlogCommentRepository("easyBlog"); blogComment.CommentBody = preArgs.CommentReplacement; blogComment = blogCommentRepository.Add(blogComment); PostSubmissionCommentEventArgs postArgs = new PostSubmissionCommentEventArgs(blogComment); _ExtensibilityManager.InvokeModuleEvent <PostSubmissionCommentEventArgs>( _ModuleEvents.PostSubmissionComment, postArgs); response = request.CreateResponse <BlogComment>(HttpStatusCode.OK, blogComment); } else { throw new ApplicationException("Comment submission has been blocked."); } } catch (Exception ex) { response = request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex); } return(response); }
public BlogCommentServiceImpl(BlogCommentMaker blogCommentMaker, BlogCommentRepository blogCommentRepo, IHostingEnvironment hostingEnvironment) { _blogCommentMaker = blogCommentMaker; _blogCommentRepo = blogCommentRepo; _hostingEnvironment = hostingEnvironment; }