Backend for the Teso project written in 2022
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
1.9 KiB

3 months ago
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");
}
}
}