diff --git a/ReallifeGamemode.Client/Business/main.ts b/ReallifeGamemode.Client/Business/main.ts index 72d1d4db..dd741789 100644 --- a/ReallifeGamemode.Client/Business/main.ts +++ b/ReallifeGamemode.Client/Business/main.ts @@ -18,133 +18,123 @@ export default function business(globalData: GlobalData) { var closeMenu = false; - var businessName; - var businessMoney; - var mainMenu; - var bankMenu; + var mainMenu: NativeUI.Menu; - mp.events.add('business_showHelp', (bizName, bizMoney) => { + var businessData: any; + var businessState: number; + + mp.events.add('SERVER:Business_ShowMenuHelp', (bizName, bizMoney) => { mp.game.ui.setTextComponentFormat('STRING'); - mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um dein Business zu verwalten'); + mp.game.ui.addTextComponentSubstringPlayerName('Drücke ~INPUT_CONTEXT~, um das Businessmenü zu öffnen'); mp.game.ui.displayHelpTextFromStringLabel(0, true, true, -1); - businessName = bizName; - businessMoney = bizMoney; - mp.keys.bind(0x45, false, keyPressHandler); keyBound = true; }); - mp.events.add('business_removeHelp', (unbind) => { + mp.events.add('SERVER:Business_SetData', (data, state: number) => { + businessData = JSON.parse(data); + businessState = state; + }); + + mp.events.add('SERVER:Business_RemoveHelp', (unbind) => { mp.game.ui.clearHelp(true); mp.gui.chat.show(true); if (keyBound && unbind) { - if (typeof mainMenu !== "undefined") mainMenu.Close(); - if (typeof bankMenu !== "undefined") { - closeMenu = true; - bankMenu.Close(); - } + if (mainMenu) mainMenu.Close(); mp.keys.unbind(0x45, false, keyPressHandler); keyBound = false; } }); - mp.events.add('business_updateMoney', (newMoney) => { - businessMoney = newMoney; - }); - function keyPressHandler() { - mp.events.call('business_removeHelp', false); - mp.gui.chat.show(false); + mp.events.call('SERVER:Business_RemoveHelp', false); if (globalData.InChat || globalData.InInput || globalData.InMenu) return; - if (typeof mainMenu !== "undefined" && mainMenu.Visible) { - return; - } - - if (typeof bankMenu !== "undefined" && bankMenu.Visible) { - return; - } globalData.InMenu = true; - mainMenu = new Menu("Businessverwaltung", businessName, new Point(50, 50), null, null); + mainMenu = new Menu("Businessverwaltung", businessData.Name, new Point(50, 50), null, null); - var bankAccountItem = new UIMenuItem("Businesskasse", "Verwalte die Businesskasse"); - bankAccountItem.SetRightLabel("~h~" + businessMoney); - mainMenu.AddItem(bankAccountItem); + var bankAccountItem: NativeUI.UIMenuItem; + + var buyItem: NativeUI.UIMenuItem; //var partnerItem = new UIMenuItem("Inteilhaber", "Verwalte den Inteilhaber"); //partnerItem.SetRightLabel("Niemand"); //mainMenu.AddItem(partnerItem); - mainMenu.Open(); + if (businessState == 1) { // Besitzer + bankAccountItem = new UIMenuItem("Businesskasse", "Verwalte die Businesskasse"); + bankAccountItem.SetRightLabel("~h~" + businessData.Balance); + mainMenu.AddItem(bankAccountItem); + + var bankMenu = new Menu("Bankkonto", businessData.Name, new Point(50, 50), null, null); + bankMenu.Visible = false; + + var infoItem = new UIMenuItem("Aktueller Kontostand"); + infoItem.SetRightLabel("~h~" + businessData.Balance); + bankMenu.AddItem(infoItem); + + var depositItem = new UIMenuItem("Einzahlen", "Zahle Geld auf die Businesskasse ein"); + bankMenu.AddItem(depositItem); + + var withdrawItem = new UIMenuItem("Auszahlen", "Zahle Geld von der Businesskasse aus"); + bankMenu.AddItem(withdrawItem); + + bankMenu.ItemSelect.on((item, index) => { + if (item === depositItem) { + var depositInput = new InputHelper("Wie viel Geld möchtest du auf deine Businesskasse einzahlen?", globalData); + depositInput.show(); + depositInput.getValue((data) => { + var amount = parseInt(data); + if (isNaN(amount)) { + mp.game.graphics.notify('~r~Du musst eine Nummer eingeben!'); + return; + } + + mp.events.callRemote('Business_DepositMoney', amount); + + mainMenu.Close(); + }); + } else if (item === withdrawItem) { + var withdrawInput = new InputHelper("Wie viel Geld möchtest du von deiner Businesskasse abheben?", globalData); + withdrawInput.show(); + withdrawInput.getValue((data) => { + var amount = parseInt(data); + if (isNaN(amount)) { + mp.game.graphics.notify('~r~Du musst eine Nummer eingeben!'); + return; + } + + mp.events.callRemote('Business_WithdrawMoney', amount); + + mainMenu.Close(); + }); + } + }); + + mainMenu.BindMenuToItem(bankMenu, bankAccountItem); + } else if (businessState == 0) { // Kein Besitzer + buyItem = new UIMenuItem("Kaufen", businessData.Price); + mainMenu.AddItem(buyItem); + } else if (businessState == -1) { + mp.game.graphics.notify("Hier gibt es nichts zu sehen"); + } mainMenu.ItemSelect.on((item, index) => { - if (item === bankAccountItem) { - // manage bank account - - bankMenu = new Menu("Bankkonto", businessName, new Point(50, 50), null, null); - - var infoItem = new UIMenuItem("Aktueller Kontostand"); - infoItem.SetRightLabel("~h~" + businessMoney); - bankMenu.AddItem(infoItem); - - var depositItem = new UIMenuItem("Einzahlen", "Zahle Geld auf die Businesskasse ein"); - bankMenu.AddItem(depositItem); - - var withdrawItem = new UIMenuItem("Auszahlen", "Zahle Geld von der Businesskasse aus"); - bankMenu.AddItem(withdrawItem); - - bankMenu.ItemSelect.on((item, index) => { - if (item === depositItem) { - var depositInput = new InputHelper("Wie viel Geld möchtest du auf deine Businesskasse einzahlen?", globalData); - depositInput.show(); - depositInput.getValue((data) => { - var amount = parseInt(data); - if (isNaN(amount)) { - mp.game.graphics.notify('~r~Du musst eine Nummer eingeben!'); - return; - } - - mp.events.callRemote('Business_DepositMoney', amount); - }); - } else if (item === withdrawItem) { - var withdrawInput = new InputHelper("Wie viel Geld möchtest du von deiner Businesskasse abheben?", globalData); - withdrawInput.show(); - withdrawInput.getValue((data) => { - var amount = parseInt(data); - if (isNaN(amount)) { - mp.game.graphics.notify('~r~Du musst eine Nummer eingeben!'); - return; - } - - mp.events.callRemote('Business_WithdrawMoney', amount); - }); - } - }); - - bankMenu.MenuClose.on(() => { - if (closeMenu) { - closeMenu = false; - return; - } - mainMenu.Visible = true; - }); - - bankMenu.Visible = true; - mainMenu.Visible = false; - + if (item === buyItem) { + mainMenu.Close(); + mp.events.callRemote("CLIENT:Business_BuyBusiness"); } - //else if (item === partnerItem) { - // // manage partner - //} }); + mainMenu.Open(); + mainMenu.MenuClose.on(() => { - mp.events.call('business_removeHelp', false); + mp.events.call('SERVER:Business_RemoveHelp', false); globalData.InMenu = false; }); } diff --git a/ReallifeGamemode.Server/Business/BusinessBase.cs b/ReallifeGamemode.Server/Business/BusinessBase.cs index 0b09b198..7c019566 100644 --- a/ReallifeGamemode.Server/Business/BusinessBase.cs +++ b/ReallifeGamemode.Server/Business/BusinessBase.cs @@ -1,4 +1,5 @@ using GTANetworkAPI; +using Newtonsoft.Json; using ReallifeGamemode.Server.Entities; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Models; @@ -65,26 +66,86 @@ namespace ReallifeGamemode.Server.Business dbContext.SaveChanges(); } } + + BusinessData data = GetData(); + + if(data == null) + { + using (var dbContext = new DatabaseContext()) + { + data = new BusinessData() + { + BusinessId = this.Id, + Price = -1 + }; + + dbContext.BusinessData.Add(data); + + dbContext.SaveChanges(); + } + } } private void EntityExitBusinessColShape(ColShape colShape, Client client) { - client.TriggerEvent("business_removeHelp", true); + client.TriggerEvent("SERVER:Business_RemoveHelp", true); + } + + public BusinessData GetData(DatabaseContext dbContext = null) + { + if(dbContext == null) + { + using (dbContext = new DatabaseContext()) + { + return dbContext.BusinessData.Where(b => b.BusinessId == this.Id).FirstOrDefault(); + } + } + else + { + return dbContext.BusinessData.Where(b => b.BusinessId == this.Id).FirstOrDefault(); + } } private void EntityEnterBusinessColShape(ColShape colShape, Client client) { - if (GetOwner() != null && GetOwner().Id == client.GetUser()?.Id && !client.IsInVehicle) + if (client.IsInVehicle || !client.IsLoggedIn()) return; + + client.TriggerEvent("SERVER:Business_ShowMenuHelp"); + SendBusinessDataToClient(client); + } + + public void SendBusinessDataToClient(Client player) + { + User owner = GetOwner(); + + int state = -1; // Keine Beziehung + + if (owner == null) // Kein Besitzer { - client.TriggerEvent("business_showHelp", Name, (GetBankAccount()?.Balance ?? 0).ToMoneyString()); + state = 0; } + else if (owner.Id == player.GetUser()?.Id) // Besitzer + { + state = 1; + } + + var business = new + { + this.Name, + Price = this.GetData().Price.ToMoneyString(), + Balance = this.GetBankAccount().Balance.ToMoneyString() + }; + + player.TriggerEvent("SERVER:Business_SetData", JsonConvert.SerializeObject(business), state); } public void Update(int? money = null) { if (money == null) money = GetBankAccount()?.Balance ?? 0; User owner = GetOwner(); - string infoText = Name + "\n" + "Besitzer: " + (owner == null ? "Niemand" : owner.Name) + "\nKasse: ~g~" + money.ToMoneyString(); + string infoText = Name; + if (owner == null) infoText += "\n~g~Zum Verkauf\n~s~Preis: ~y~" + this.GetData().Price.ToMoneyString(); + else infoText += $"\nBesitzer: ~g~{owner.Name}\n~s~Kasse: ~y~{money.ToMoneyString()}"; _informationLabel.Text = infoText; } diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index 77566d0a..9de6c381 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -2871,6 +2871,47 @@ namespace ReallifeGamemode.Server.Commands } } + [Command("business", "~m~Benutzung:~s~ /business [price] [Option]")] + public void CmdAdminBusiness(Client player, string option, string option1) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.HEADADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + BusinessBase business = BusinessManager.GetNearBusiness(player); + + if(business == null) + { + ChatService.ErrorMessage(player, "In deiner Nähe ist kein Business"); + return; + } + + switch (option.ToLower()) + { + case "price": + if(!int.TryParse(option1, out int price)) + { + ChatService.ErrorMessage(player, "Es muss ein gültiger Preis angegeben werden"); + return; + } + using (var dbContext = new DatabaseContext()) + { + BusinessData data = business.GetData(dbContext); + data.Price = price; + dbContext.SaveChanges(); + + player.SendChatMessage($"Der Preis wurde auf {price.ToMoneyString()} gesetzt"); + + business.Update(); + return; + } + break; + } + + player.SendChatMessage("~m~Benutzung:~s~ /business [price] [Option]"); + } #endregion diff --git a/ReallifeGamemode.Server/Entities/BusinessData.cs b/ReallifeGamemode.Server/Entities/BusinessData.cs new file mode 100644 index 00000000..c609d139 --- /dev/null +++ b/ReallifeGamemode.Server/Entities/BusinessData.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +using System.Text; + +namespace ReallifeGamemode.Server.Entities +{ + public class BusinessData + { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] + public int Id { get; set; } + + public int BusinessId { get; set; } + + public int Price { get; set; } + } +} diff --git a/ReallifeGamemode.Server/Managers/BusinessManager.cs b/ReallifeGamemode.Server/Managers/BusinessManager.cs index ce66ffc1..43f25ca1 100644 --- a/ReallifeGamemode.Server/Managers/BusinessManager.cs +++ b/ReallifeGamemode.Server/Managers/BusinessManager.cs @@ -4,6 +4,7 @@ using ReallifeGamemode.Server.Business; using ReallifeGamemode.Server.Entities; using ReallifeGamemode.Server.Extensions; using ReallifeGamemode.Server.Models; +using ReallifeGamemode.Server.Services; using ReallifeGamemode.Server.Util; using System; using System.Collections.Generic; @@ -48,6 +49,11 @@ namespace ReallifeGamemode.Server.Managers return Businesses.Find(b => b.Id == id); } + public static BusinessBase GetNearBusiness(Client player) + { + return Businesses.Where(b => b.Position.DistanceTo(player.Position) < 5f).FirstOrDefault(); + } + [RemoteEvent("Business_DepositMoney")] public void BusinessDepositMoney(Client player, int amount) { @@ -61,20 +67,19 @@ namespace ReallifeGamemode.Server.Managers TransactionResult result = BankManager.TransferMoney(user, playerBusiness, amount, "Überweisung"); - /*if(result == TransactionResult.NEGATIVE_MONEY_SENT) + if (result == TransactionResult.NEGATIVE_MONEY_SENT) { - player.SendNotification("~r~Es können nur positive Beträge überwiesen werden"); - return; + player.SendNotification("~r~Es können nur positive Beträge überwiesen werden"); + return; } - else if(result == TransactionResult.SENDER_NOT_ENOUGH_MONEY) + else if (result == TransactionResult.SENDER_NOT_ENOUGH_MONEY) { - player.SendNotification("~r~Du hast nicht genug Geld"); - return; + player.SendNotification("~r~Du hast nicht genug Geld"); + return; } - else */ - if (result == TransactionResult.SUCCESS) + else if (result == TransactionResult.SUCCESS) { - player.TriggerEvent("business_updateMoney", playerBusiness.GetBankAccount().Balance.ToMoneyString()); + playerBusiness.SendBusinessDataToClient(player); player.SendNotification("~g~Du hast erfolgreich ~s~" + amount.ToMoneyString() + " ~g~ überwiesen"); return; } @@ -105,7 +110,7 @@ namespace ReallifeGamemode.Server.Managers } else if (result == TransactionResult.SUCCESS) { - player.TriggerEvent("business_updateMoney", playerBusiness.GetBankAccount().Balance.ToMoneyString()); + playerBusiness.SendBusinessDataToClient(player); player.SendNotification("~g~Du hast erfolgreich ~s~" + amount.ToMoneyString() + " ~g~ überwiesen"); return; } @@ -209,5 +214,46 @@ namespace ReallifeGamemode.Server.Managers newVeh.Spawn(); } + + [RemoteEvent("CLIENT:Business_BuyBusiness")] + public void BusinessEventBuyBusiness(Client player) + { + BusinessBase business = GetNearBusiness(player); + if (business == null) return; + + if (business.GetOwner() != null) + { + ChatService.ErrorMessage(player, "Dieses Business hat einen Besitzer"); + return; + } + + using (var dbContext = new DatabaseContext()) + { + int price = business.GetData().Price; + User user = player.GetUser(dbContext); + + if(user.BusinessId != null) + { + ChatService.ErrorMessage(player, "Du kannst nicht mehrere Businesse besitzen"); + } + + IBankAccount bankAccount = user.GetBankAccount(dbContext); + + if (price > bankAccount.Balance) + { + ChatService.ErrorMessage(player, "Du hast nicht genung Geld"); + return; + } + + user.BusinessId = business.Id; + bankAccount.Balance -= price; + + player.SendChatMessage("Business gekauft"); + + dbContext.SaveChanges(); + + business.Update(); + } + } } } diff --git a/ReallifeGamemode.Server/Migrations/20190911192912_BusinessData.Designer.cs b/ReallifeGamemode.Server/Migrations/20190911192912_BusinessData.Designer.cs new file mode 100644 index 00000000..ef80206c --- /dev/null +++ b/ReallifeGamemode.Server/Migrations/20190911192912_BusinessData.Designer.cs @@ -0,0 +1,1310 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using ReallifeGamemode.Server.Models; + +namespace ReallifeGamemode.Migrations +{ + [DbContext(typeof(DatabaseContext))] + [Migration("20190911192912_BusinessData")] + partial class BusinessData + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.0-rtm-35687") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.ATM", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Faulty"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("ATMs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Ban", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Applied"); + + b.Property("BannedBy"); + + b.Property("Reason"); + + b.Property("UntilDateTime"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Bans"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.BusRoute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Description"); + + b.HasKey("Id"); + + b.ToTable("BusRoutes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.BusRoutePoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BusRouteId"); + + b.Property("Description"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("BusRouteId"); + + b.ToTable("BusRoutesPoints"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.BusinessBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Balance"); + + b.Property("BusinessId"); + + b.HasKey("Id"); + + b.HasIndex("BusinessId") + .IsUnique(); + + b.ToTable("BusinessBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.BusinessData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BusinessId"); + + b.Property("Price"); + + b.HasKey("Id"); + + b.ToTable("BusinessData"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Character", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Ageing"); + + b.Property("AgeingOpacity"); + + b.Property("BeardColor"); + + b.Property("Blemishes"); + + b.Property("BlemishesOpacity"); + + b.Property("Blush"); + + b.Property("BlushColor"); + + b.Property("BlushOpacity"); + + b.Property("BrowDepth"); + + b.Property("BrowHeight"); + + b.Property("CheekDepth"); + + b.Property("CheekboneHeight"); + + b.Property("CheekboneWidth"); + + b.Property("ChestHair"); + + b.Property("ChestHairColor"); + + b.Property("ChestHairOpacity"); + + b.Property("ChinDepth"); + + b.Property("ChinHeight"); + + b.Property("ChinIndent"); + + b.Property("ChinWidth"); + + b.Property("Complexion"); + + b.Property("ComplexionOpacity"); + + b.Property("EyeColor"); + + b.Property("EyeSize"); + + b.Property("EyebrowColor"); + + b.Property("Eyebrows"); + + b.Property("EyebrowsOpacity"); + + b.Property("FacialHair"); + + b.Property("FacialHairOpacity"); + + b.Property("Father"); + + b.Property("Freckles"); + + b.Property("FrecklesOpacity"); + + b.Property("Gender"); + + b.Property("Hair"); + + b.Property("HairColor"); + + b.Property("HairHighlightColor"); + + b.Property("JawShape"); + + b.Property("JawWidth"); + + b.Property("LipThickness"); + + b.Property("Lipstick"); + + b.Property("LipstickColor"); + + b.Property("LipstickOpacity"); + + b.Property("Makeup"); + + b.Property("MakeupOpacity"); + + b.Property("Mother"); + + b.Property("NeckWidth"); + + b.Property("NoseBottomHeight"); + + b.Property("NoseBridgeDepth"); + + b.Property("NoseBroken"); + + b.Property("NoseTipHeight"); + + b.Property("NoseTipLength"); + + b.Property("NoseWidth"); + + b.Property("Similarity"); + + b.Property("SkinSimilarity"); + + b.Property("SunDamage"); + + b.Property("SunDamageOpacity"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.CharacterCloth", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClothId"); + + b.Property("Duty"); + + b.Property("SlotId"); + + b.Property("SlotType"); + + b.Property("Texture"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("CharacterClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.ClothCombination", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Gender"); + + b.Property("Top"); + + b.Property("Torso"); + + b.Property("Undershirt"); + + b.HasKey("Id"); + + b.ToTable("ClothCombinations"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Door", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Category"); + + b.Property("FactionId"); + + b.Property("Locked"); + + b.Property("Model"); + + b.Property("Name"); + + b.Property("Radius"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("Doors"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.DutyCloth", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ClothId"); + + b.Property("FactionId"); + + b.Property("Gender"); + + b.Property("SlotId"); + + b.Property("SlotType"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("DutyClothes"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Faction", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name") + .HasMaxLength(32); + + b.Property("StateOwned"); + + b.HasKey("Id"); + + b.ToTable("Factions"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Bic") + .HasMaxLength(12); + + b.Property("FactionId"); + + b.Property("Iban") + .HasMaxLength(32); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionRank", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("FactionId"); + + b.Property("Order"); + + b.Property("RankName"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionRanks"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionWeapon", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("FactionId"); + + b.Property("Rank"); + + b.Property("SlotID"); + + b.Property("WeaponModel"); + + b.HasKey("Id"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionWeapons"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.GotoPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Description") + .HasMaxLength(32); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("GotoPoints"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Group", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Groups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Balance"); + + b.Property("GroupId"); + + b.HasKey("Id"); + + b.HasIndex("GroupId"); + + b.ToTable("GroupBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.House", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CanRentIn"); + + b.Property("OwnerId"); + + b.Property("Price"); + + b.Property("RentalFee"); + + b.Property("Type"); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.HasIndex("OwnerId"); + + b.ToTable("Houses"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRental", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("HouseId"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("HouseId"); + + b.HasIndex("UserId"); + + b.ToTable("HouseRentals"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Interior", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("EnterPositionStr") + .HasColumnName("EnterPosition"); + + b.Property("ExitPositionStr") + .HasColumnName("ExitPosition"); + + b.Property("Name"); + + b.HasKey("Id"); + + b.ToTable("Interiors"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.BankAccountTransactionHistory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Fee"); + + b.Property("MoneySent"); + + b.Property("NewReceiverBalance"); + + b.Property("NewSenderBalance"); + + b.Property("Origin") + .HasMaxLength(32); + + b.Property("Receiver") + .HasMaxLength(32); + + b.Property("ReceiverBalance"); + + b.Property("Sender") + .HasMaxLength(32); + + b.Property("SenderBalance"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd(); + + b.HasKey("Id"); + + b.ToTable("BankAccountTransactionLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("CauseOfDeath") + .HasMaxLength(64); + + b.Property("KillerHeading"); + + b.Property("KillerId"); + + b.Property("KillerPositionX"); + + b.Property("KillerPositionY"); + + b.Property("KillerPositionZ"); + + b.Property("Timestamp") + .ValueGeneratedOnAdd(); + + b.Property("VictimHeading"); + + b.Property("VictimId"); + + b.Property("VictimPositionX"); + + b.Property("VictimPositionY"); + + b.Property("VictimPositionZ"); + + b.HasKey("Id"); + + b.HasIndex("KillerId"); + + b.HasIndex("VictimId"); + + b.ToTable("DeathLogs"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.News", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Caption"); + + b.Property("Content"); + + b.Property("Timestamp"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("News"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedBlip", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Alpha"); + + b.Property("Color"); + + b.Property("Dimension"); + + b.Property("DrawDistance"); + + b.Property("Name"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("Rotation"); + + b.Property("Scale"); + + b.Property("ShortRange"); + + b.Property("Sprite"); + + b.HasKey("Id"); + + b.ToTable("Blips"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedMarker", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ColorA"); + + b.Property("ColorB"); + + b.Property("ColorG"); + + b.Property("ColorR"); + + b.Property("Dimension"); + + b.Property("DirectionX"); + + b.Property("DirectionY"); + + b.Property("DirectionZ"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RotationX"); + + b.Property("RotationY"); + + b.Property("RotationZ"); + + b.Property("Scale"); + + b.Property("Type"); + + b.Property("Visible"); + + b.HasKey("Id"); + + b.ToTable("Markers"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedPed", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Dimension"); + + b.Property("HashModel"); + + b.Property("Heading"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.HasKey("Id"); + + b.ToTable("Peds"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedPickup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Dimension"); + + b.Property("PositionX") + .HasMaxLength(128); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RespawnTime"); + + b.Property("RotationX"); + + b.Property("RotationY"); + + b.Property("RotationZ"); + + b.Property("Vehicle"); + + b.HasKey("Id"); + + b.ToTable("Pickups"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedTextLabel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("ColorA"); + + b.Property("ColorB"); + + b.Property("ColorG"); + + b.Property("ColorR"); + + b.Property("Dimension"); + + b.Property("DrawDistance"); + + b.Property("Font"); + + b.Property("LOS"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("Text") + .IsRequired(); + + b.HasKey("Id"); + + b.ToTable("TextLabels"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.ServerVehicle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active") + .ValueGeneratedOnAdd() + .HasDefaultValue(true); + + b.Property("Discriminator") + .IsRequired(); + + b.Property("DistanceDriven"); + + b.Property("Heading"); + + b.Property("Livery"); + + b.Property("Locked"); + + b.Property("Model"); + + b.Property("NumberPlate") + .HasMaxLength(8); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("PrimaryColor"); + + b.Property("SecondaryColor"); + + b.Property("TankAmount"); + + b.HasKey("Id"); + + b.ToTable("ServerVehicles"); + + b.HasDiscriminator("Discriminator").HasValue("ServerVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.TuningGarage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("X"); + + b.Property("Y"); + + b.Property("Z"); + + b.HasKey("Id"); + + b.ToTable("TuningGarages"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("AdminLevel"); + + b.Property("BanId"); + + b.Property("BusinessId"); + + b.Property("CharacterId"); + + b.Property("Dead"); + + b.Property("Email") + .HasMaxLength(64); + + b.Property("FactionId"); + + b.Property("FactionLeader"); + + b.Property("FactionRankId"); + + b.Property("GroupId"); + + b.Property("GroupRank"); + + b.Property("Handmoney"); + + b.Property("HouseId"); + + b.Property("JailTime"); + + b.Property("JobId"); + + b.Property("LogUserId"); + + b.Property("Name") + .HasMaxLength(32); + + b.Property("Password") + .HasMaxLength(64); + + b.Property("PaydayTimer"); + + b.Property("PositionX"); + + b.Property("PositionY"); + + b.Property("PositionZ"); + + b.Property("RegistrationDate") + .ValueGeneratedOnAdd(); + + b.Property("SocialClubName") + .HasMaxLength(32); + + b.Property("Wage"); + + b.Property("Wanteds"); + + b.HasKey("Id"); + + b.HasIndex("BanId"); + + b.HasIndex("BusinessId") + .IsUnique(); + + b.HasIndex("CharacterId"); + + b.HasIndex("FactionId"); + + b.HasIndex("FactionRankId"); + + b.HasIndex("GroupId"); + + b.HasIndex("HouseId"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Active"); + + b.Property("Balance"); + + b.Property("Bic") + .HasMaxLength(12); + + b.Property("Iban") + .HasMaxLength(32); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserBankAccounts"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("ItemId"); + + b.Property("Slot"); + + b.Property("UserId"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("Amount"); + + b.Property("ItemId"); + + b.Property("Slot"); + + b.Property("VehicleId"); + + b.HasKey("Id"); + + b.HasIndex("VehicleId"); + + b.ToTable("VehicleItems"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleMod", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("ModId"); + + b.Property("ServerVehicleId"); + + b.Property("Slot"); + + b.HasKey("Id"); + + b.HasIndex("ServerVehicleId", "Slot") + .IsUnique(); + + b.ToTable("VehicleMods"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Whitelist", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("SocialClubName"); + + b.HasKey("Id"); + + b.ToTable("WhitelistEntries"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.Property("FactionId"); + + b.HasIndex("FactionId"); + + b.ToTable("FactionVehicles"); + + b.HasDiscriminator().HasValue("FactionVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.Property("GroupId"); + + b.HasIndex("GroupId"); + + b.HasDiscriminator().HasValue("GroupVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.JobVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.Property("JobId"); + + b.HasDiscriminator().HasValue("JobVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Saves.SavedVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.HasDiscriminator().HasValue("SavedVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.ShopVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.Property("BusinessId"); + + b.Property("Price"); + + b.ToTable("ShopVehicles"); + + b.HasDiscriminator().HasValue("ShopVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserVehicle", b => + { + b.HasBaseType("ReallifeGamemode.Server.Entities.ServerVehicle"); + + b.Property("UserId"); + + b.HasIndex("UserId"); + + b.ToTable("UserVehicles"); + + b.HasDiscriminator().HasValue("UserVehicle"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Ban", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.BusRoutePoint", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.BusRoute", "BusRoute") + .WithMany("RoutePoints") + .HasForeignKey("BusRouteId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Character", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.CharacterCloth", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Door", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.DutyCloth", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionBankAccount", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionRank", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionWeapon", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupBankAccount", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.House", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "Owner") + .WithMany() + .HasForeignKey("OwnerId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.HouseRental", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.House", "House") + .WithMany() + .HasForeignKey("HouseId"); + + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Logs.Death", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "Killer") + .WithMany() + .HasForeignKey("KillerId"); + + b.HasOne("ReallifeGamemode.Server.Entities.User", "Victim") + .WithMany() + .HasForeignKey("VictimId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.News", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.User", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Ban", "Ban") + .WithMany() + .HasForeignKey("BanId"); + + b.HasOne("ReallifeGamemode.Server.Entities.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId"); + + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + + b.HasOne("ReallifeGamemode.Server.Entities.FactionRank", "FactionRank") + .WithMany() + .HasForeignKey("FactionRankId"); + + b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + + b.HasOne("ReallifeGamemode.Server.Entities.House", "House") + .WithMany() + .HasForeignKey("HouseId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserBankAccount", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserItem", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleItem", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.VehicleMod", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.ServerVehicle", "Vehicle") + .WithMany() + .HasForeignKey("ServerVehicleId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.FactionVehicle", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Faction", "Faction") + .WithMany() + .HasForeignKey("FactionId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.GroupVehicle", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.Group", "Group") + .WithMany() + .HasForeignKey("GroupId"); + }); + + modelBuilder.Entity("ReallifeGamemode.Server.Entities.UserVehicle", b => + { + b.HasOne("ReallifeGamemode.Server.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/ReallifeGamemode.Server/Migrations/20190911192912_BusinessData.cs b/ReallifeGamemode.Server/Migrations/20190911192912_BusinessData.cs new file mode 100644 index 00000000..57e5752f --- /dev/null +++ b/ReallifeGamemode.Server/Migrations/20190911192912_BusinessData.cs @@ -0,0 +1,31 @@ +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; + +namespace ReallifeGamemode.Migrations +{ + public partial class BusinessData : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "BusinessData", + columns: table => new + { + Id = table.Column(nullable: false) + .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn), + BusinessId = table.Column(nullable: false), + Price = table.Column(nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BusinessData", x => x.Id); + }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BusinessData"); + } + } +} diff --git a/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs b/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs index 515236c6..e6dc47e9 100644 --- a/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs +++ b/ReallifeGamemode.Server/Migrations/DatabaseContextModelSnapshot.cs @@ -112,6 +112,20 @@ namespace ReallifeGamemode.Migrations b.ToTable("BusinessBankAccounts"); }); + modelBuilder.Entity("ReallifeGamemode.Server.Entities.BusinessData", b => + { + b.Property("Id") + .ValueGeneratedOnAdd(); + + b.Property("BusinessId"); + + b.Property("Price"); + + b.HasKey("Id"); + + b.ToTable("BusinessData"); + }); + modelBuilder.Entity("ReallifeGamemode.Server.Entities.Character", b => { b.Property("Id") diff --git a/ReallifeGamemode.Server/Models/DatabaseContext.cs b/ReallifeGamemode.Server/Models/DatabaseContext.cs index 19e5ed34..2ad7dc94 100644 --- a/ReallifeGamemode.Server/Models/DatabaseContext.cs +++ b/ReallifeGamemode.Server/Models/DatabaseContext.cs @@ -79,6 +79,7 @@ namespace ReallifeGamemode.Server.Models // Business public DbSet BusinessBankAccounts { get; set; } + public DbSet BusinessData { get; set; } // Control Panel public DbSet News { get; set; }