public IActionResult UpdateGallery(int id)
        {
            if (id == 0)
            {
                ViewData["GeneralError"] = Messages.GeneralError;
                return(RedirectToAction("ListGallery", "ManagementPanel"));
            }

            var data = _galleryService.GetById(id);

            if (data.Data == null)
            {
                ViewData["GeneralError"] = Messages.GeneralError;
                return(RedirectToAction("ListGallery", "ManagementPanel"));
            }

            UpdateGalleryPageModel model = new UpdateGalleryPageModel
            {
                Description = data.Data.Description,
                Id          = data.Data.Id
            };



            var selectBox = GetCategoryImageSelectBoxView(data.Data);



            ViewData["AllCategories"] = selectBox;


            return(View(model));
        }
        public IHttpActionResult Get(Guid id)
        {
            var galleryBindingModel = Mapper.Map <Gallery, GalleryBindingModel>(_galleryService.GetById(id));

            if (galleryBindingModel != null)
            {
                return(Ok(galleryBindingModel));
            }
            return(Content(HttpStatusCode.NotFound, "Gallery not found!"));
        }
Example #3
0
        public IActionResult PhotoDetail(int id)
        {
            var galeri = _galleryService.GetById(id);
            var model  = _galleryFactory.PreParePhotoGalleryListModel(galeri.Id);

            return(View(model));
        }
Example #4
0
        public IActionResult GetById(int id)
        {
            var result = galleryManager.GetById(id);

            if (result.Success)
            {
                return(Ok(result));
            }
            return(BadRequest(result));
        }
Example #5
0
        public GalleryModel PrePareGalleryModel(int galleryId)
        {
            if (galleryId == 0)
            {
                return(new GalleryModel());
            }

            var query = _galleryService.GetById(galleryId);
            var model = new GalleryModel();

            model.Name               = query.Name;
            model.DisplayOrder       = query.DisplayOrder;
            model.Published          = query.Published;
            model.Id                 = query.Id;
            model.PhotoGalleryModels = PreParePhotoGalleryListModel(model.Id);
            return(model);
        }