public IActionResult AddKomentar([FromForm] PrihvatanjeSlikeKomentara data) { if (data == null) { return(BadRequest()); } _IKomentariUI.saveImage(data); return(Ok()); }
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); }
public void saveImage(PrihvatanjeSlikeKomentara image) { _IKomentariDAL.saveImage(image); }