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.

38 lines
1.1 KiB

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Teso_API.Models;
namespace Teso_API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class PullDPController : ControllerBase
{
private readonly TESOContext _context;
public PullDPController(TESOContext context)
{
_context = context;
}
// GET: api/PullDP/5
[HttpGet("{id}")]
public IActionResult GetAccountType(string id)
{
string dpname = _context.TesoUserDetails.AsQueryable().Where(i => i.UserGUID == id).Select(d => d.ThumbnailDp).FirstOrDefault();
if (!String.IsNullOrEmpty(dpname))
{
return PhysicalFile(ServerLocation.displayPicture + dpname, "image/jpeg");
}
else
{
return PhysicalFile(ServerLocation.displayPicture + "default.jpg", "image/jpeg");
}
}
}
}