This commit is contained in:
Adam 2024-03-13 20:02:38 +01:00
commit 1005c4d39f
4 changed files with 38 additions and 27 deletions

View File

@ -0,0 +1,15 @@
namespace TIAM.Entities.Transfers;
public interface ITransfeDestinationPrices
{
//public PriceType PriceType { get; set; }
public double Price { get; set; }
public double? Price2 { get; set; }
public double? Price3 { get; set; }
public double? ExtraPrice { get; set; }
/// <summary>
/// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő...
/// </summary>
public bool? ExtraPriceType { get; set; }
}

View File

@ -8,7 +8,7 @@ using TIAM.Entities.Addresses;
namespace TIAM.Entities.Transfers namespace TIAM.Entities.Transfers
{ {
[Table("TransferDestination")] [Table("TransferDestination")]
public class TransferDestination : IEntityGuid, ITimeStampInfo //LocationBase public class TransferDestination : IEntityGuid, ITransfeDestinationPrices, ITimeStampInfo //LocationBase
{ {
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)] [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; } public Guid Id { get; set; }
@ -24,10 +24,15 @@ namespace TIAM.Entities.Transfers
public string Description { get; set; } public string Description { get; set; }
//public PriceType PriceType { get; set; }
public double Price { get; set; } public double Price { get; set; }
public double Price2 { get; set; } public double? Price2 { get; set; }
public double Price3 { get; set; } public double? Price3 { get; set; }
public double? ExtraPrice { get; set; }
/// <summary>
/// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő...
/// </summary>
public bool? ExtraPriceType { get; set; }
//TEMPORARY!!! //TEMPORARY!!!
public string? AddressString { get; set; } public string? AddressString { get; set; }
@ -44,12 +49,12 @@ namespace TIAM.Entities.Transfers
Id = id; Id = id;
AddressString = addressString; AddressString = addressString;
} }
public TransferDestination(Guid id, string name, string addressString, double price, double price2, double price3) : this(id, addressString) public TransferDestination(Guid id, string name, string addressString) : this(id, addressString)
{ {
Name = name; Name = name;
} }
public TransferDestination(Guid id, string name, string description, string addressString, double price, double price2, double price3) : this(id, name, addressString, price, price2, price3) public TransferDestination(Guid id, string name, string description, string addressString) : this(id, name, addressString)
{ {
Description = description; Description = description;
} }

View File

@ -8,7 +8,7 @@ using TIAM.Entities.Products;
namespace TIAM.Entities.Transfers namespace TIAM.Entities.Transfers
{ {
[Table(nameof(TransferDestinationToProduct))] [Table(nameof(TransferDestinationToProduct))]
public class TransferDestinationToProduct : IEntityGuid, ITimeStampInfo, IProductForeignKey public class TransferDestinationToProduct : IEntityGuid, ITimeStampInfo, IProductForeignKey, ITransfeDestinationPrices
{ {
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)] [Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
public Guid Id { get; set; } public Guid Id { get; set; }
@ -19,14 +19,16 @@ namespace TIAM.Entities.Transfers
public Guid TransferDestinationId { get; set; } public Guid TransferDestinationId { get; set; }
public virtual TransferDestination TransferDestination { get; set; } public virtual TransferDestination TransferDestination { get; set; }
//public PriceType PriceType { get; set; }
public double Price { get; set; } public double Price { get; set; }
public double? Price2 { get; set; } public double? Price2 { get; set; }
public double? Price3 { get; set; } public double? Price3 { get; set; }
public double? ExtraPrice { get; set; } public double? ExtraPrice { get; set; }
/// <summary>
/// Kihajtás v. behajtás az ExtraPrice! Ha null, akkor mindkettő...
/// </summary>
public bool? ExtraPriceType { get; set; } public bool? ExtraPriceType { get; set; }
public DateTime Created { get; set; } public DateTime Created { get; set; }
public DateTime Modified { get; set; } public DateTime Modified { get; set; }
} }

View File

@ -52,19 +52,7 @@ namespace TIAMWebApp.Server.Controllers
[Route(APIUrls.GetTransferDestinationsRouteName)] [Route(APIUrls.GetTransferDestinationsRouteName)]
public async Task<IEnumerable<TransferDestination>> GetTransferDestinations() public async Task<IEnumerable<TransferDestination>> GetTransferDestinations()
{ {
var transferDestinations = await _adminDal.Context.TransferDestinations.ToListAsync(); return await _transferDestinationDal.Context.TransferDestinations.ToListAsync();
foreach (var transferDestination in transferDestinations)
{
Console.WriteLine($"TransferDestination: {transferDestination.Id}");
Console.WriteLine($"TransferDestination: {transferDestination.AddressId}");
Console.WriteLine($"TransferDestination: {transferDestination.Name}");
Console.WriteLine($"TransferDestination: {transferDestination.Price}");
Console.WriteLine($"TransferDestination: {transferDestination.Price2}");
Console.WriteLine($"TransferDestination: {transferDestination.Price3}");
Console.WriteLine($"TransferDestination: {transferDestination.AddressString}");
Console.WriteLine($"TransferDestination: {transferDestination.Description}");
}
return transferDestinations;
} }
[AllowAnonymous] [AllowAnonymous]
@ -114,9 +102,10 @@ namespace TIAMWebApp.Server.Controllers
Console.WriteLine($"TransferDestination to be created: {transferDestination.AddressId}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.AddressId}");
Console.WriteLine($"TransferDestination to be created: {transferDestination.Name}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.Name}");
Console.WriteLine($"TransferDestination to be created: {transferDestination.Price}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.Price}");
//Console.WriteLine($"TransferDestination to be created: {transferDestination.Price2}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.Price2}");
//Console.WriteLine($"TransferDestination to be created: {transferDestination.Price3}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.Price3}");
//Console.WriteLine($"TransferDestination to be created: {transferDestination.PriceType}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.ExtraPrice}");
Console.WriteLine($"TransferDestination to be created: {transferDestination.ExtraPriceType}");
Console.WriteLine($"TransferDestination to be created: {transferDestination.AddressString}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.AddressString}");
Console.WriteLine($"TransferDestination to be created: {transferDestination.Description}"); Console.WriteLine($"TransferDestination to be created: {transferDestination.Description}");
@ -172,8 +161,8 @@ namespace TIAMWebApp.Server.Controllers
Console.WriteLine($"TransferDestination to be updated: {transferDestination.Id}"); Console.WriteLine($"TransferDestination to be updated: {transferDestination.Id}");
Console.WriteLine($"TransferDestination to be updated new name: {transferDestination.Name}"); Console.WriteLine($"TransferDestination to be updated new name: {transferDestination.Name}");
Console.WriteLine($"TransferDestination to be updated new price: {transferDestination.Price}"); Console.WriteLine($"TransferDestination to be updated new price: {transferDestination.Price}");
Console.WriteLine($"TransferDestination to be updated new price: {transferDestination.Price2}"); //Console.WriteLine($"TransferDestination to be updated new price: {transferDestination.Price2}");
Console.WriteLine($"TransferDestination to be updated new price: {transferDestination.Price3}"); //Console.WriteLine($"TransferDestination to be updated new price: {transferDestination.Price3}");
//Console.WriteLine($"TransferDestination to be updated new priceType: {transferDestination.PriceType}"); //Console.WriteLine($"TransferDestination to be updated new priceType: {transferDestination.PriceType}");
Console.WriteLine($"TransferDestination to be updated new address: {transferDestination.AddressString}"); Console.WriteLine($"TransferDestination to be updated new address: {transferDestination.AddressString}");
Console.WriteLine($"TransferDestination to be updated new description: {transferDestination.Description}"); Console.WriteLine($"TransferDestination to be updated new description: {transferDestination.Description}");