Ejemplo n.º 1
0
        public ActionResult DeleteImage(int?id)
        {
            //Find the Image
            Image currentImage = imageRepository.GetImages().Where(x => x.Id == id).FirstOrDefault();

            //Check if Exist
            if (currentImage == null)
            {
                return(RedirectToAction("Index", "Home"));
            }


            return(View(currentImage));
        }
        public async Task <ImagesList> Get(string searchTerm, int index, CancellationToken ct)
        {
            var images = (await _imagesService.GetImages(
                              searchTerm,
                              index,
                              imgs => imgs.OrderByDescending(n => n.Width),
                              ct))
                         .RemoveNonPng();

            return(new ImagesList(images));
        }
Ejemplo n.º 3
0
        public async Task <IEnumerable <ImagesResponse> > Get()
        {
            var images = await _imageService.GetImages();

            var response = images.Select(img => new ImagesResponse
            {
                Uri      = img.Uri.AbsoluteUri,
                FileName = Path.GetFileName(img.Uri.AbsolutePath)
            });

            return(response);
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> GetImages([Required] string userId, [Required] int page,
                                                    [Required] int itemCount)
        {
            var request = new PaginationRequest {
                ItemCount = itemCount, Page = page
            };
            var images = await _imageService.GetImages(userId, request);

            foreach (var image in images.Data)
            {
                await AddInformationToImage(image);
            }

            return(Ok(images));
        }
        public HttpResponseMessage GetImages(long buid)
        {
            ImagesViewModel viewModel = new ImagesViewModel();

            try
            {
                viewModel.imageses = _imagesService.GetImages(buid);
                if (viewModel.imageses != null)
                {
                    viewModel.BusinessStatus = 1;
                }
                else
                {
                    viewModel.BusinessStatus = -10000;
                    viewModel.StatusMessage  = "没有照片数据";
                }
            }
            catch (Exception)
            {
                viewModel.BusinessStatus = 10002;
                viewModel.StatusMessage  = "查询图片异常";
            }
            return(viewModel.ResponseToJson());
        }
Ejemplo n.º 6
0
 // GET: Home
 public ActionResult Index()
 {
     return(View(imageRepository.GetImages()));
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Повертає список зображень
 /// </summary>
 /// <returns>Список зображень</returns>
 public IEnumerable <ImagesDtoModel> GetImagesDto() => imagesService.GetImages();