public VideoGalleryListModel PrePareVideoGalleryListModel(VideoGalleryPagingFilteringModel command) { var model = new VideoGalleryListModel(); if (command.PageSize <= 0) { command.PageSize = 15; } if (command.PageNumber <= 0) { command.PageNumber = 1; } var videos = _videoService.GetAllVideoGallery(pageIndex: command.PageNumber, pageSize: command.PageSize); model.VideoGalleryModels = videos.Select(x => { var galery = new VideoGalleryModel(); galery.Name = x.Name; galery.Published = x.Published; galery.Id = x.Id; galery.VideoModels = PrePareVideoGalleryList(x.Id); return(galery); }).ToList(); return(model); }
public CategoriModel() { LargeNewsModels = new List <NewsItemModel>(); NewsModels = new List <NewsItemModel>(); PagingFilteringContext = new CatalogPagingFilteringModel(); VideoGalleryModel = new VideoGalleryModel(); GalleryModel = new GalleryModel(); SliderModel = new SliderModel(); }
public virtual ActionResult AddVideo(string id) { VideoGalleryModel model = null; _objuser = new UserPresenter(); if (!string.IsNullOrEmpty(id)) { model = _objuser.GetVideo(long.Parse(id)); } return(View(model)); }
public bool AddImages(VideoGalleryModel video) { var objgallery = video.ConvertToObject <VideoGallery>(); if (video.Id != 0) { objgallery.Id = video.Id; return(_objRepository.UpdateVideo(objgallery)); } return(_objRepository.AddVideo(objgallery)); }
public async Task <ActionResult> UpdateGalleryChild(OutModels.Models.VideoGallery vg) { try { VideoGalleryModel pcm = (VideoGalleryModel)_mapper.Map <OutModels.Models.VideoGallery, VideoGalleryModel>(vg); return(new JsonResult(await this._repository.Update(pcm))); } catch (Exception ex) { return(null); } }
public async Task <ActionResult> AddChild(OutModels.Models.VideoGallery vg) { try { VideoGalleryModel b = (VideoGalleryModel)_mapper.Map <OutModels.Models.VideoGallery, VideoGalleryModel>(vg); return(new JsonResult(await this._repository.Insert(b))); } catch (Exception ex) { return(null); } }
public virtual ActionResult AddVideo(VideoGalleryModel gallery) { if (ModelState.IsValid) { _objuser = new UserPresenter(); var ioutput = _objuser.AddImages(gallery); return(RedirectToAction(MVC.Admin.VideoGalleryListView())); } else { const string message = "Inavlid data"; ModelState.AddModelError("", message); } return(View()); }
public VideoGalleryModel PrepareVideoGalleryModel(int videoId) { if (videoId == 0) { return(new VideoGalleryModel()); } var query = _videoService.GetByVideoGallery(videoId); if (query == null) { return(new VideoGalleryModel()); } var model = new VideoGalleryModel { Id = query.Id, Name = query.Name, Published = query.Published, }; var video = _videoService.GetByVideo(videoId); model.VideoModels = PrePareVideoGalleryList(videoId); return(model); }
public void GetVideoGalleriesFromService_AndSetToViewModel() { // Arrange var mockedDTO = new VideoGalleryModel { Id = "1", Name = "First" }; var galleries = new VideoGalleryModel[] { mockedDTO }; var mockedService = new Mock <IVideoService>(); mockedService.Setup(s => s.GetAll()).Returns(galleries).Verifiable(); var controller = new VideosController(mockedService.Object); // Act var view = controller.Index() as ViewResult; var model = view.ViewData.Model as VideoGalleriesViewModel; // Assert Assert.IsTrue(model.Galleries.Count() == 2); Assert.IsTrue(model.Galleries.First().Value == ""); Assert.IsTrue(model.Galleries.Last().Value == mockedDTO.Id); Assert.IsTrue(model.Galleries.Last().Text == mockedDTO.Name); mockedService.Verify(s => s.GetAll(), Times.Once); }
public void GetAllGalleryNames_AndStoreItToViewModel() { // Arrange var galleryNames = new VideoGalleryModel[] { new VideoGalleryModel { Name = "Test" }, new VideoGalleryModel { Name = "Test2" } }; var mockedService = new Mock <IVideoService>(); mockedService.Setup(s => s.GetAll()).Returns(galleryNames).Verifiable(); var mockedVideoFactory = new Mock <IVideoFactory>(); var mockedDateProvider = new Mock <IDateProvider>(); var controller = new VideoController(mockedService.Object, mockedVideoFactory.Object, mockedDateProvider.Object); // Act var view = controller.Add() as ViewResult; var model = view.ViewData.Model as AddVideoViewModel; // Assert Assert.IsAssignableFrom <AddVideoViewModel>(model); Assert.IsTrue(model.GalleryNames.Count() == 3); Assert.IsTrue(model.GalleryNames.Last().Text == "Test2"); }
public SubCategoryModel() { VideoGalleryModel = new VideoGalleryModel(); GalleryModel = new GalleryModel(); SliderModel = new SliderModel(); }
public bool UpdateImage(VideoGalleryModel video) { var objgallery = video.ConvertToObject <VideoGallery>(); return(_objRepository.UpdateVideo(objgallery)); }
public NewsItemModel() { Comments = new List <NewsCommentModel>(); AddNewComment = new AddNewsCommentModel(); VideoGalleryModel = new VideoGalleryModel(); }