using System.Linq;
using Microsoft.EntityFrameworkCore;
using ReallifeGamemode.Database.Entities;
using ReallifeGamemode.Database.Models;

namespace ReallifeGamemode.Server.Extensions
{
  internal static class HouseExtensions
  {
    public static House Refresh(this House house)
    {
      using (var dbContext = new DatabaseContext())
      {
        return dbContext.Houses.Where(h => h.Id == house.Id).Include(h => h.Owner).FirstOrDefault();
      }
    }
  }
}
