Continued business system

This commit is contained in:
hydrant
2018-11-18 22:21:02 +01:00
parent 52d8a74498
commit 53b9acab8b
8 changed files with 89 additions and 15 deletions

View File

@@ -1,35 +0,0 @@
using reallife_gamemode.Model;
using reallife_gamemode.Server.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
namespace reallife_gamemode.Server.Entities
{
public class Business : IBankAccountOwner
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Name { get; set; }
public IBankAccount GetBankAccount (DatabaseContext databaseContext = null)
{
if (databaseContext == null)
{
using (databaseContext = new DatabaseContext())
{
return databaseContext.BusinessBankAccounts.FirstOrDefault(u => u.BusinessId == this.Id);
}
}
else
{
return databaseContext.BusinessBankAccounts.FirstOrDefault(u => u.BusinessId == this.Id);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using reallife_gamemode.Server.Util;
using reallife_gamemode.Server.Business;
using reallife_gamemode.Server.Util;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
@@ -14,8 +15,8 @@ namespace reallife_gamemode.Server.Entities
public int Id { get; set; }
public int Balance { get; set; }
[ForeignKey("Business")]
public int BusinessId { get; set; }
public Business Business { get; set; }
[NotMapped]
public BusinessBase Business { get; set; }
}
}