示例#1
0
        public IActionResult AddKomentar([FromForm] PrihvatanjeSlikeKomentara data)
        {
            if (data == null)
            {
                return(BadRequest());
            }

            _IKomentariUI.saveImage(data);

            return(Ok());
        }
示例#2
0
        public void saveImage(PrihvatanjeSlikeKomentara image)
        {
            long id = _context.komentari.Count();

            if (id == 0)
            {
                id = 1;
            }
            else
            {
                id = _context.komentari.Max(o => o.id) + 1;
            }
            var urlSlike           = "komentari//images//image" + id + ".jpg";
            var PathWithFolderName = System.IO.Path.Combine(_IWebHostEnvironment.WebRootPath, urlSlike);
            var stream             = System.IO.File.Create(PathWithFolderName);

            image.slika.CopyTo(stream);
        }
示例#3
0
 public void saveImage(PrihvatanjeSlikeKomentara image)
 {
     _IKomentariDAL.saveImage(image);
 }