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

namespace ReallifeGamemode.Server.Extensions
{
  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();
      }
    }
  }
}
