using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Teso_API.Models; namespace Teso_API.Controllers { [AllowAnonymous, Route("tesoimages")] [ApiController] public class FilesController : ControllerBase { [Route("[action]/{filename}")] [HttpGet] public IActionResult GetProfilePicture(string filename) { if (!String.IsNullOrEmpty(filename) && filename.ToLower() != "null") { return PhysicalFile(ServerLocation.displayPicture + filename, "image/jpeg"); } else { return PhysicalFile(ServerLocation.displayPicture + "default.jpg", "image/jpeg"); } } [Route("[action]/{filename}")] [HttpGet] public IActionResult GetProducts(string filename) { if (!String.IsNullOrEmpty(filename) && filename.ToLower() != "null") { return PhysicalFile(ServerLocation.ProductImage + filename, "image/jpeg"); } else { return null; } } [Route("[action]/{filename}")] [HttpGet] public IActionResult GetLogo(string filename) { if (!String.IsNullOrEmpty(filename) && filename.ToLower() != "null") { return PhysicalFile(ServerLocation.businessLogo + filename, "image/jpeg"); } else { return null; } } [Route("[action]/{filename}")] [HttpGet] public IActionResult GetVideo(string filename) { return PhysicalFile(ServerLocation.videoAds + filename, "video/mp4"); } } }