Exemple #1
0
        public FileContentResult GetImg(int id, string type)
        {
            //int id = 1;
            //string type = "图片切换";
            var       list  = dal.GetImage(type);
            ImageFile model = new ImageFile();

            if (id <= list.Count && list.Count > 0 && list.Any())
            {
                if (list[id - 1] != null)
                {
                    model           = list[id - 1];
                    ViewBag.ImgName = model.ImageName;
                    if (model.ImageFilePath != null)
                    {
                        return(File(model.ImageFilePath, "image/jpg", model.ID.ToString() + model.ImageName));
                    }
                    else
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }
            else
            {
                return(null);
            }
        }
Exemple #2
0
        public ActionResult GetImageFile(int id, string type)
        {
            ImageFile model = new ImageFile();

            var list = imagedal.GetImage(type);

            if (id <= list.Count && list.Count > 0 && list.Any())
            {
                if (list[id - 1] != null)
                {
                    model        = list[id - 1];
                    ViewBag.ID   = id;
                    ViewBag.Type = type;
                }
            }
            return(View(model));
        }