Merge
This commit is contained in:
commit
aaff1bfcb2
|
|
@ -6,6 +6,7 @@ using TIAM.Core.Enums;
|
|||
using TIAM.Database.DataLayers.Admins;
|
||||
using TIAM.Database.DbContexts.Admins;
|
||||
using TIAM.Database.DbSets.Emails;
|
||||
using TIAM.Entities.Addresses;
|
||||
using TIAM.Entities.Drivers;
|
||||
using TIAM.Entities.Emails;
|
||||
using TIAM.Entities.Products;
|
||||
|
|
@ -324,6 +325,7 @@ namespace TIAM.Database.Test
|
|||
//Assert.IsNotNull(user.UserProductMappings[0].Product, "Product is null");
|
||||
}
|
||||
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(["8f38f8e3-a92c-4979-88b1-dc812a82245f", "814b5495-c2e9-4f1d-a73f-37cd5d353078", "71392CFD-FB9C-45C1-9540-7BE3782CF26A"])]
|
||||
public async Task TransferCrudTest(string[] transferIdProductIdUserProductIdStrings)
|
||||
|
|
@ -384,6 +386,67 @@ namespace TIAM.Database.Test
|
|||
Assert.IsNull(transfer); //a korábbi törlés miatt NULL kell legyen - J.
|
||||
}
|
||||
|
||||
[DataTestMethod]
|
||||
[DataRow(["069089cd-66d4-4f0d-851b-2eea14fa62a4", "be709d9b-87dc-4c94-bf9e-d6254db3fa3e"])]
|
||||
public async Task TransferDestinationCrudTest(string[] transferDestIdaddressIdStrings)
|
||||
{
|
||||
var transferDestId = Guid.Parse(transferDestIdaddressIdStrings[0]);
|
||||
var addressId = Guid.Parse(transferDestIdaddressIdStrings[1]);
|
||||
|
||||
var name = "Liszt Ferenc repülőtér";
|
||||
var address = "Budapest, Liszt Ferenc tér";
|
||||
var modifiedAddress = "modified; " + address;
|
||||
|
||||
await Dal.RemoveTransferDestinationAsync(transferDestId, true); //kitöröljük a szemetet, ha korábbról bentmaradt - J.
|
||||
|
||||
var transferDest = new TransferDestination
|
||||
{
|
||||
Id = transferDestId,
|
||||
AddressId = addressId,
|
||||
Name = name,
|
||||
Description = name + "description",
|
||||
Price = 15000,
|
||||
Price2 = 21000,
|
||||
Price3 = 23000,
|
||||
PriceType = PriceType.Fix,
|
||||
Address = new Address
|
||||
{
|
||||
Id = addressId,
|
||||
AddressText = address,
|
||||
IsValid = false,
|
||||
IsHelper = false,
|
||||
Latitude = new Random().NextDouble() + 42d,
|
||||
Longitude = new Random().NextDouble() + 19d
|
||||
}
|
||||
};
|
||||
|
||||
Assert.IsTrue(await Dal.AddTransferDestinationAsync(transferDest));
|
||||
Assert.IsNotNull(transferDest);
|
||||
|
||||
transferDest = Dal.GetTransferDestinationById(transferDestId);
|
||||
|
||||
Assert.IsNotNull(transferDest);
|
||||
Assert.IsNotNull(transferDest.Address);
|
||||
|
||||
transferDest.Price = 20000;
|
||||
transferDest.Address.AddressText = modifiedAddress;
|
||||
|
||||
Assert.IsTrue(await Dal.UpdateTransferDestinationAsync(transferDest));
|
||||
|
||||
transferDest = Dal.GetTransferDestinationById(transferDestId);
|
||||
|
||||
Assert.IsNotNull(transferDest);
|
||||
Assert.IsNotNull(transferDest.Address);
|
||||
|
||||
Assert.IsTrue(transferDest.Price == 20000);
|
||||
Assert.IsTrue(transferDest.Address.AddressText == modifiedAddress);
|
||||
Assert.IsTrue(transferDest.Id == transferDestId, "transferDest.Id != transferDestId");
|
||||
|
||||
Assert.IsTrue(await Dal.RemoveTransferDestinationAsync(transferDestId, true)); //mielőbb kitöröljük, h ne maradjon szemét a db-ben - J.
|
||||
|
||||
transferDest = Dal.GetTransferDestinationById(transferDestId);
|
||||
Assert.IsNull(transferDest); //a korábbi törlés miatt NULL kell legyen - J.
|
||||
}
|
||||
#endregion Transfer
|
||||
|
||||
#region EmailMessage
|
||||
|
|
@ -424,6 +487,7 @@ namespace TIAM.Database.Test
|
|||
var contextId = Guid.Parse(emailIdSenderIdContextIdSenderEmailRecipientIdStrings[2]);
|
||||
var senderEmail = emailIdSenderIdContextIdSenderEmailRecipientIdStrings[3];
|
||||
var recipientId = Guid.Parse(emailIdSenderIdContextIdSenderEmailRecipientIdStrings[4]);
|
||||
var recipientEmail = "info@touriam.com";
|
||||
|
||||
var subject = "Transfer - Budapest, Liszt Ferenc tér";
|
||||
var text = "1211 Budapest, Kossuth Lajos utca 145";
|
||||
|
|
@ -431,7 +495,7 @@ namespace TIAM.Database.Test
|
|||
await Dal.RemoveEmailMessageAsync(emailMessageId); //kitöröljük a szemetet, ha korábbról bentmaradt - J.
|
||||
|
||||
var emailMessage = new EmailMessage(emailMessageId, senderId, contextId, subject, text, senderEmail);
|
||||
emailMessage.Recipients.Add(new EmailRecipient(id: Guid.NewGuid(), recipientId, emailMessageId));
|
||||
emailMessage.Recipients.Add(new EmailRecipient(id: Guid.NewGuid(), recipientId, emailMessageId, recipientEmail));
|
||||
|
||||
|
||||
Assert.IsTrue(await Dal.AddEmailMessageAsync(emailMessage));
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
using System.Security.Cryptography.X509Certificates;
|
||||
using AyCode.Database.DbSets.Users;
|
||||
using AyCode.Database.DbSets.Users;
|
||||
using AyCode.Models.Enums;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using TIAM.Core;
|
||||
//using TIAM.Database.DataLayers.ServiceProviders;
|
||||
using TIAM.Database.DbContexts.Admins;
|
||||
|
|
@ -16,7 +14,6 @@ using TIAM.Entities.Emails;
|
|||
using TIAM.Entities.Permissions;
|
||||
using TIAM.Entities.Products;
|
||||
using TIAM.Entities.ServiceProviders;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAM.Entities.Users;
|
||||
using TIAM.Models.Dtos.Products;
|
||||
|
|
@ -37,17 +34,17 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
public Transfer? GetTransferById(Guid transferId, bool autoInclude = false) => Session(ctx => ctx.GetTransferById(transferId, autoInclude));
|
||||
public string? GetTransferJsonById(Guid transferId, bool autoInclude = false) => Session(ctx => ctx.GetTransferById(transferId, autoInclude)?.ToJson());
|
||||
|
||||
public Task<bool> AddTransferAsync(Transfer transfer) => TransactionAsync(ctx => ctx.AddTransfer(transfer) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> UpdateTransferAsync(Transfer transfer) => TransactionAsync(ctx => ctx.UpdateTransfer(transfer) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> RemoveTransferAsync(Transfer transfer) => TransactionAsync(ctx => ctx.RemoveTransfer(transfer) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> RemoveTransferAsync(Guid transferId) => TransactionAsync(ctx => ctx.RemoveTransfer(transferId) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> AddTransferAsync(Transfer transfer) => TransactionAsync(ctx => ctx.AddTransfer(transfer));
|
||||
public Task<bool> UpdateTransferAsync(Transfer transfer) => TransactionAsync(ctx => ctx.UpdateTransfer(transfer));
|
||||
public Task<bool> RemoveTransferAsync(Transfer transfer) => TransactionAsync(ctx => ctx.RemoveTransfer(transfer));
|
||||
public Task<bool> RemoveTransferAsync(Guid transferId) => TransactionAsync(ctx => ctx.RemoveTransfer(transferId));
|
||||
#endregion Transfer
|
||||
|
||||
#region TransferDestination
|
||||
public Task<bool> AddTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.AddTransferDestination(transferDestination) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> UpdateTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.UpdateTransferDestination(transferDestination) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> RemoveTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.RemoveTransferDestination(transferDestination) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> RemoveTransferDestinationAsync(Guid transferDestinationId) => TransactionAsync(ctx => ctx.RemoveTransferDestination(transferDestinationId) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> AddTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.AddTransferDestination(transferDestination));
|
||||
public Task<bool> UpdateTransferDestinationAsync(TransferDestination transferDestination) => TransactionAsync(ctx => ctx.UpdateTransferDestination(transferDestination));
|
||||
public Task<bool> RemoveTransferDestinationAsync(TransferDestination transferDestination, bool removeAddress = false) => TransactionAsync(ctx => ctx.RemoveTransferDestination(transferDestination, removeAddress));
|
||||
public Task<bool> RemoveTransferDestinationAsync(Guid transferDestinationId, bool removeAddress = false) => TransactionAsync(ctx => ctx.RemoveTransferDestination(transferDestinationId, removeAddress));
|
||||
|
||||
#endregion TransferDestination
|
||||
|
||||
|
|
@ -66,10 +63,10 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
public string GetProductsJson(bool includeUsers = true) => Session(ctx => ctx.ProductsWithUserRelations(includeUsers).ToJson());
|
||||
public List<Product> GetProductsByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByServiceProviderId(serviceProviderId, includeUsers).ToList());
|
||||
public string GetProductsJsonByServiceProviderId(Guid serviceProviderId, bool includeUsers = true) => Session(ctx => ctx.GetProductsByServiceProviderId(serviceProviderId, includeUsers).ToJson());
|
||||
public Task<bool> AddProduct(Product product) => TransactionAsync(ctx => ctx.AddProduct(product) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> AddProduct(Product product) => TransactionAsync(ctx => ctx.AddProduct(product));
|
||||
|
||||
public Task<bool> UpdateProduct(Product product) => TransactionAsync(ctx => ctx.UpdateProduct(product) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> RemoveProduct(Product product) => TransactionAsync(ctx => ctx.RemoveProduct(product) && ctx.SaveChanges() > 0);
|
||||
public Task<bool> UpdateProduct(Product product) => TransactionAsync(ctx => ctx.UpdateProduct(product));
|
||||
public Task<bool> RemoveProduct(Product product) => TransactionAsync(ctx => ctx.RemoveProduct(product));
|
||||
|
||||
public UserProductMapping? GetUserProductMappingById(Guid userProductMappingId, bool autoInclude = true) => Session(ctx => ctx.GetUserProductMappingById(userProductMappingId, autoInclude));
|
||||
public Task<UserProductMapping?> GetUserProductMappingByIdAsync(Guid userProductMappingId, bool autoInclude = true) => SessionAsync(ctx => ctx.GetUserProductMappingById(userProductMappingId, autoInclude));
|
||||
|
|
@ -88,7 +85,7 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
|
||||
#region UserProductMapping
|
||||
public Task<bool> AddUserProductMappingAsync(UserProductMapping userProductMapping)
|
||||
=> TransactionAsync(ctx => ctx.AddUserProductMapping(userProductMapping) && ctx.SaveChanges() > 0);
|
||||
=> TransactionAsync(ctx => ctx.AddUserProductMapping(userProductMapping));
|
||||
|
||||
public async Task<UserProductMapping?> AddUserProductMappingAsync(Guid userProductMappingId, Guid userId, Guid productId, int permissions = 1, UserProductJsonDetailModel? userProductToCars = null)
|
||||
{
|
||||
|
|
@ -98,14 +95,14 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
{
|
||||
userProductMapping = ctx.AddUserProductMapping(userProductMappingId, userId, productId, permissions, userProductToCars);
|
||||
|
||||
return userProductMapping != null && ctx.SaveChanges() > 0;
|
||||
return userProductMapping != null;
|
||||
});
|
||||
|
||||
return isSucces ? userProductMapping : null;
|
||||
}
|
||||
|
||||
public Task<bool> UpdateUserProductMappingAsync(UserProductMapping userProductMapping)
|
||||
=> TransactionAsync(ctx => ctx.UpdateUserProductMapping(userProductMapping) && ctx.SaveChanges() > 0);
|
||||
=> TransactionAsync(ctx => ctx.UpdateUserProductMapping(userProductMapping));
|
||||
|
||||
public async Task<UserProductMapping?> UpdateUserProductMappingAsync(Guid userProductMappingId, int permissions = 1, UserProductJsonDetailModel? userProductToCars = null)
|
||||
{
|
||||
|
|
@ -115,17 +112,17 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
{
|
||||
userProductMapping = ctx.UpdateUserProductMapping(userProductMappingId, permissions, userProductToCars);
|
||||
|
||||
return userProductMapping != null && ctx.SaveChanges() > 0;
|
||||
return userProductMapping != null;
|
||||
});
|
||||
|
||||
return isSucces ? userProductMapping : null;
|
||||
}
|
||||
|
||||
public Task<bool> RemoveUserProductMappingAsync(Guid userProductMappingId)
|
||||
=> TransactionAsync(ctx => ctx.RemoveUserProductMapping(userProductMappingId) && ctx.SaveChanges() > 0);
|
||||
=> TransactionAsync(ctx => ctx.RemoveUserProductMapping(userProductMappingId));
|
||||
|
||||
public Task<bool> RemoveUserProductMappingAsync(Guid userId, Guid productId)
|
||||
=> TransactionAsync(ctx => ctx.RemoveUserProductMapping(userId, productId) && ctx.SaveChanges() > 0);
|
||||
=> TransactionAsync(ctx => ctx.RemoveUserProductMapping(userId, productId));
|
||||
|
||||
#endregion UserProductMapping
|
||||
|
||||
|
|
@ -139,13 +136,13 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
|
||||
|
||||
public Task<bool> AddEmailMessageAsync(EmailMessage emailMessage)
|
||||
=> TransactionAsync(ctx => ctx.AddEmailMessage(emailMessage) && ctx.SaveChanges() > 0);
|
||||
=> TransactionAsync(ctx => ctx.AddEmailMessage(emailMessage));
|
||||
|
||||
public Task<bool> UpdateEmailMessageAsync(EmailMessage emailMessage)
|
||||
=> TransactionAsync(ctx => ctx.UpdateEmailMessage(emailMessage) && ctx.SaveChanges() > 0);
|
||||
=> TransactionAsync(ctx => ctx.UpdateEmailMessage(emailMessage));
|
||||
|
||||
public Task<bool> RemoveEmailMessageAsync(Guid emailMessageId)
|
||||
=> TransactionAsync(ctx => ctx.RemoveEmailMessage(emailMessageId) && ctx.SaveChanges() > 0);
|
||||
=> TransactionAsync(ctx => ctx.RemoveEmailMessage(emailMessageId));
|
||||
|
||||
#endregion EmailMessage
|
||||
|
||||
|
|
@ -327,26 +324,26 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
{
|
||||
List<AssignedPermissionModel> result = new List<AssignedPermissionModel>();
|
||||
|
||||
var UserProductMappings = Context.UserProductMappings.Where(x => x.ProductId == contextId).ToListAsync();
|
||||
var userProductMappings = Context.UserProductMappings.Where(x => x.ProductId == contextId).ToList();
|
||||
|
||||
if (UserProductMappings.Result != null)
|
||||
//if (userProductMappings.Result != null)
|
||||
{
|
||||
foreach (var item in UserProductMappings.Result)
|
||||
foreach (var item in userProductMappings)
|
||||
{
|
||||
var mappingRow = Context.PermissionContextMappings.Where(x => x.SubjectId == item.Id).ToListAsync();
|
||||
if (mappingRow.Result == null)
|
||||
var mappingRows = Context.PermissionContextMappings.Where(x => x.SubjectId == item.Id).ToList();
|
||||
if (mappingRows.Count == 0)
|
||||
{
|
||||
//user has no permission but is assigned... must be banned
|
||||
|
||||
}
|
||||
else if (mappingRow.Result.Count > 1)
|
||||
else if (mappingRows.Count > 1)
|
||||
{
|
||||
//user has been assigned more than onece to same context
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var mapping in mappingRow.Result)
|
||||
foreach (var mapping in mappingRows)
|
||||
{
|
||||
result.Add(new AssignedPermissionModel(item.ProductId, item.Id, mapping.SubjectType, item.UserId.ToString(), mapping.Permissions));
|
||||
}
|
||||
|
|
@ -355,26 +352,26 @@ namespace TIAM.Database.DataLayers.Admins
|
|||
}
|
||||
}
|
||||
|
||||
var AssingedGroups = Context.PermissionGroups.Where(x => x.OwnerId == contextId).ToListAsync();
|
||||
var assingedGroups = Context.PermissionGroups.Where(x => x.OwnerId == contextId).ToList();
|
||||
|
||||
if (AssingedGroups.Result != null)
|
||||
//if (assingedGroups.Result != null)
|
||||
{
|
||||
foreach (var group in AssingedGroups.Result)
|
||||
foreach (var group in assingedGroups)
|
||||
{
|
||||
var mappingRow = Context.PermissionContextMappings.Where(x => x.SubjectId == group.Id).ToListAsync();
|
||||
if (mappingRow.Result == null)
|
||||
var mappingRows = Context.PermissionContextMappings.Where(x => x.SubjectId == group.Id).ToList();
|
||||
if (mappingRows.Count == 0)
|
||||
{
|
||||
//group has no permission but is assigned...
|
||||
|
||||
}
|
||||
else if (mappingRow.Result.Count > 1)
|
||||
else if (mappingRows.Count > 1)
|
||||
{
|
||||
//group has been assigned more than onece to same context
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var mapping in mappingRow.Result)
|
||||
foreach (var mapping in mappingRows)
|
||||
{
|
||||
result.Add(new AssignedPermissionModel(group.OwnerId, group.Id, mapping.SubjectType, group.GroupName, mapping.Permissions));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ using TIAM.Database.DbSets.Users;
|
|||
using AyCode.Database.DataLayers;
|
||||
using AyCode.Database.DbSets.Users;
|
||||
using TIAM.Database.DbSets.Products;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Models.Dtos.Users;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using AyCode.Utils.Extensions;
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Identity.Client;
|
||||
using TIAM.Database.DbContexts.Transfers;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAM.Entities.Users;
|
||||
|
||||
namespace TIAM.Database.DataLayers.TransferDestinations;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ using TIAM.Entities.Permissions;
|
|||
using TIAM.Entities.Products;
|
||||
using TIAM.Entities.Profiles;
|
||||
using TIAM.Entities.ServiceProviders;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAM.Entities.Users;
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ using System.Threading.Tasks;
|
|||
using AyCode.Database.DbContexts;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TIAM.Entities.Auctions;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
|
||||
namespace TIAM.Database.DbContexts.Auctions
|
||||
{
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ using TIAM.Entities.Addresses;
|
|||
using TIAM.Entities.Permissions;
|
||||
using TIAM.Entities.Products;
|
||||
using TIAM.Entities.ServiceProviders;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAM.Entities.Users;
|
||||
|
||||
namespace TIAM.Database.DbContexts.ServiceProviders
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ using System.Linq;
|
|||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
|
||||
namespace TIAM.Database.DbContexts.Transfers
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ using TIAM.Entities.Emails;
|
|||
using TIAM.Entities.Permissions;
|
||||
using TIAM.Entities.Products;
|
||||
using TIAM.Entities.Profiles;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAM.Entities.Users;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public static class EmailMessageDbSetExtension
|
|||
=> ctx.EmailMessages.Where(x => x.SenderId == senderId);
|
||||
|
||||
public static IQueryable<EmailMessage> GetEmailMessagesBySenderEmailAddress(this IEmailMessageDbSet ctx, string senderEmailAddress)
|
||||
=> ctx.EmailMessages.Where(x => x.SenderEmailAddress == senderEmailAddress);
|
||||
=> ctx.EmailMessages.Where(x => x.EmailAddress == senderEmailAddress);
|
||||
|
||||
private static IQueryable<EmailMessage> GetEmailMessages(this IQueryable<EmailMessage> queryableEmails, Guid userId, Guid userProductMappingId)
|
||||
=> queryableEmails.Where(x => x.SenderId == userId || x.SenderId == userProductMappingId || x.Recipients.Any(recipient => recipient.RecipientId == userId || recipient.RecipientId == userProductMappingId));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
|
||||
namespace TIAM.Database.DbSets.Transfers;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using TIAM.Entities.Addresses;
|
||||
using TIAM.Entities.Products;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
|
||||
namespace TIAM.Database.DbSets.Transfers;
|
||||
|
||||
public interface ITransferDestinationDbSet
|
||||
{
|
||||
public DbSet<TransferDestination> TransferDestinations { get; set; }
|
||||
public DbSet<Address> Addresses { get; set; }
|
||||
}
|
||||
|
|
@ -1,8 +1,4 @@
|
|||
using Microsoft.EntityFrameworkCore;
|
||||
using TIAM.Database.DbSets.Products;
|
||||
using TIAM.Database.DbSets.Users;
|
||||
using TIAM.Entities.Products;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
|
||||
namespace TIAM.Database.DbSets.Transfers;
|
||||
|
|
@ -47,13 +43,17 @@ public static class TransferDbSetExtensions
|
|||
public static bool UpdateTransferDestination(this ITransferDestinationDbSet ctx, TransferDestination transferDestination)
|
||||
=> ctx.TransferDestinations.Update(transferDestination).State == EntityState.Modified;
|
||||
|
||||
public static bool RemoveTransferDestination(this ITransferDestinationDbSet ctx, TransferDestination transferDestination)
|
||||
=> ctx.TransferDestinations.Remove(transferDestination).State == EntityState.Deleted;
|
||||
|
||||
public static bool RemoveTransferDestination(this ITransferDestinationDbSet ctx, Guid transferDestinationId)
|
||||
public static bool RemoveTransferDestination(this ITransferDestinationDbSet ctx, TransferDestination transferDestination, bool removeAddress)
|
||||
{
|
||||
var transfer = ctx.GetTransferDestinationById(transferDestinationId);
|
||||
return transfer == null || ctx.RemoveTransferDestination(transferDestinationId);
|
||||
if (removeAddress) ctx.Addresses.Remove(transferDestination.Address);
|
||||
|
||||
return ctx.TransferDestinations.Remove(transferDestination).State == EntityState.Deleted;
|
||||
}
|
||||
|
||||
public static bool RemoveTransferDestination(this ITransferDestinationDbSet ctx, Guid transferDestinationId, bool removeAddress)
|
||||
{
|
||||
var transferDestination = ctx.GetTransferDestinationById(transferDestinationId);
|
||||
return transferDestination == null || ctx.RemoveTransferDestination(transferDestination, removeAddress);
|
||||
}
|
||||
|
||||
#endregion TransferDestination
|
||||
|
|
|
|||
|
|
@ -3,24 +3,25 @@ using System.ComponentModel.DataAnnotations;
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using AyCode.Interfaces.Entities;
|
||||
using AyCode.Interfaces.TimeStampInfo;
|
||||
using AyCode.Interfaces.Users;
|
||||
|
||||
namespace TIAM.Entities.Emails;
|
||||
|
||||
[Table(nameof(EmailMessage))]
|
||||
public class EmailMessage : IEntityGuid, ITimeStampInfo, IEmailRecipientsRelation
|
||||
public class EmailMessage : IEntityGuid, ITimeStampInfo, IEmailRecipientsRelation, IEmailAddress
|
||||
{
|
||||
public EmailMessage()
|
||||
{
|
||||
}
|
||||
|
||||
public EmailMessage(Guid id, Guid? senderId, Guid contextId, string subject, string? text, string senderEmailAddress) : this()
|
||||
public EmailMessage(Guid id, Guid? senderId, Guid contextId, string subject, string? text, string emailAddress) : this()
|
||||
{
|
||||
Id = id;
|
||||
SenderId = senderId;
|
||||
ContextId = contextId;
|
||||
Subject = subject;
|
||||
Text = text;
|
||||
SenderEmailAddress = senderEmailAddress;
|
||||
EmailAddress = emailAddress;
|
||||
}
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
|
|
@ -32,7 +33,7 @@ public class EmailMessage : IEntityGuid, ITimeStampInfo, IEmailRecipientsRelatio
|
|||
public virtual List<EmailRecipient> Recipients { get; set; } = [];
|
||||
|
||||
[MaxLength(150)]
|
||||
public string SenderEmailAddress { get; set; }
|
||||
public string EmailAddress { get; set; }
|
||||
[MaxLength(100)]
|
||||
public string Subject { get; set; }
|
||||
public string? Text { get; set; }
|
||||
|
|
|
|||
|
|
@ -2,21 +2,23 @@
|
|||
using AyCode.Interfaces.TimeStampInfo;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using AyCode.Interfaces.Users;
|
||||
|
||||
namespace TIAM.Entities.Emails;
|
||||
|
||||
//Update efcore, aspnetcore to 8.0.1; Implement EmailMessage, EmailRecipient; refactoring, improvments, fixes, etc...
|
||||
public class EmailRecipient : IEntityGuid, ITimeStampInfo, IEmailMessageRelation
|
||||
public class EmailRecipient : IEntityGuid, ITimeStampInfo, IEmailMessageRelation, IEmailAddress
|
||||
{
|
||||
public EmailRecipient()
|
||||
{
|
||||
}
|
||||
|
||||
public EmailRecipient(Guid id, Guid recipientId, Guid emailMessageId) : this()
|
||||
public EmailRecipient(Guid id, Guid recipientId, Guid emailMessageId, string emailAddress) : this()
|
||||
{
|
||||
Id = id;
|
||||
RecipientId = recipientId;
|
||||
EmailMessageId = emailMessageId;
|
||||
EmailAddress = emailAddress;
|
||||
}
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.None)]
|
||||
|
|
@ -24,6 +26,9 @@ public class EmailRecipient : IEntityGuid, ITimeStampInfo, IEmailMessageRelation
|
|||
|
||||
public Guid RecipientId { get; set; }
|
||||
public Guid EmailMessageId { get; set; }
|
||||
public string EmailAddress { get; set; }
|
||||
|
||||
|
||||
public virtual EmailMessage EmailMessage { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,13 +1,11 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using AyCode.Interfaces.Entities;
|
||||
using AyCode.Entities.Locations;
|
||||
using AyCode.Interfaces.TimeStampInfo;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Text.RegularExpressions;
|
||||
using TIAM.Core.Enums;
|
||||
using TIAM.Entities.Addresses;
|
||||
|
||||
namespace TIAM.Entities.TransferDestinations
|
||||
namespace TIAM.Entities.Transfers
|
||||
{
|
||||
[Table("TransferDestination")]
|
||||
public class TransferDestination : IEntityGuid, ITimeStampInfo //LocationBase
|
||||
|
|
@ -23,11 +21,13 @@ namespace TIAM.Entities.TransferDestinations
|
|||
|
||||
public string Description { get; set; }
|
||||
|
||||
public double Price { get; set; }
|
||||
public PriceType PriceType { get; set; }
|
||||
public double Price { get; set; }
|
||||
public double Price2 { get; set; }
|
||||
public double Price3 { get; set; }
|
||||
|
||||
//TEMPORARY!!!
|
||||
public string AddressString { get; set; }
|
||||
public string? AddressString { get; set; }
|
||||
|
||||
public DateTime Created { get; set; }
|
||||
public DateTime Modified { get; set; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using Microsoft.AspNetCore.Components.Forms;
|
|||
using Microsoft.AspNetCore.Components.Web;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq.Expressions;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAMWebApp.Shared.Application.Utility;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
||||
using TIAMWebApp.Shared.Application.Models.PageModels;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@
|
|||
@using System.IdentityModel.Tokens.Jwt;
|
||||
@using TIAMSharedUI.Pages.Components;
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAM.Entities.TransferDestinations
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
@inject NavigationManager NavManager
|
||||
@inject IUserDataService UserDataService;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using TIAM.Entities.TransferDestinations
|
||||
@using TIAM.Entities.Transfers
|
||||
@inject LogToBrowserConsole logToBrowserConsole
|
||||
@inject IWizardProcessor WizardProcessor
|
||||
<h3>TestPage</h3>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
@page "/transfer"
|
||||
@using TIAM.Entities.TransferDestinations
|
||||
@using TIAMSharedUI.Pages.Components
|
||||
@using TIAMSharedUI.Shared
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
|||
using TIAMWebApp.Shared.Application.Models;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
|
||||
namespace TIAMSharedUI.Pages.User.SysAdmins
|
||||
{
|
||||
|
|
@ -105,7 +104,7 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
|
|||
//add new orderData to orderData array
|
||||
|
||||
//await NwindDataService.InsertEmployeeAsync((EditableEmployee)e.EditModel);
|
||||
await transferDataService.CreateTransferDestination(TransferDestinationWizardModel.SaveToTransferDestination(myModel));
|
||||
await transferDataService.CreateTransferDestination(TransferDestinationWizardModel.CopyToTransferDestination(myModel));
|
||||
//await transferDataService.CreateTransferDestination(new TransferDestination
|
||||
/*{
|
||||
Id = Guid.NewGuid(),
|
||||
|
|
@ -142,7 +141,7 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
|
|||
transferToModify.Price = myModel.Price;
|
||||
transferToModify.PriceType = myModel.PriceType;
|
||||
|
||||
await transferDataService.UpdateTransferDestination(TransferDestinationWizardModel.SaveToTransferDestination(transferToModify));
|
||||
await transferDataService.UpdateTransferDestination(TransferDestinationWizardModel.CopyToTransferDestination(transferToModify));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -177,7 +176,7 @@ namespace TIAMSharedUI.Pages.User.SysAdmins
|
|||
{
|
||||
//add new transferwizardmodel to transferData array
|
||||
TransferDataFromDb = ((TransferDestinationWizardModel[])TransferDataFromDb).Append(
|
||||
new TransferDestinationWizardModel(item.Id, item.Name, item.Description, item.AddressString, item.Price, item.PriceType)).ToArray();
|
||||
new TransferDestinationWizardModel(item.Id, item.Name, item.Description, item.AddressString, item.Price, item.PriceType, item.Address)).ToArray();
|
||||
logToBrowserConsole.LogToBC($"TransferDataFromDb: {item.Name}");
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
@using System.Linq.Expressions
|
||||
@using TIAM.Entities.Transfers
|
||||
@using TIAMWebApp.Shared.Application.Interfaces
|
||||
@using TIAMWebApp.Shared.Application.Utility
|
||||
@using TIAM.Entities.TransferDestinations
|
||||
@inject LogToBrowserConsole logToBrowserConsole
|
||||
|
||||
<style>
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ using System.Net.Http.Json;
|
|||
using System.Text.Json;
|
||||
using TIAM.Entities.Permissions;
|
||||
using TIAM.Entities.Products;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Models.Dtos.Products;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ using Microsoft.JSInterop;
|
|||
using Newtonsoft.Json;
|
||||
using System.Net.Http.Json;
|
||||
using System.Text;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Users;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using TIAM.Database.DataLayers.Admins;
|
|||
using TIAM.Database.DataLayers.TransferDestinations;
|
||||
using TIAM.Database.DataLayers.Users;
|
||||
using TIAM.Database.DbContexts;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAM.Entities.Users;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
||||
|
|
@ -74,16 +74,16 @@ namespace TIAMWebApp.Server.Controllers
|
|||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.CreateTransferDestinationRouteName)]
|
||||
public async Task<IActionResult> CreateTransferDestination([FromBody] JsonElement SerializedTransferDestinationModel)
|
||||
public async Task<IActionResult> CreateTransferDestination([FromBody] JsonElement serializedTransferDestinationModel)
|
||||
{
|
||||
Console.WriteLine("CreateTransferDestination called!");
|
||||
if (string.IsNullOrEmpty(SerializedTransferDestinationModel.GetRawText()))
|
||||
if (string.IsNullOrEmpty(serializedTransferDestinationModel.GetRawText()))
|
||||
{
|
||||
return BadRequest("SerializedTramsferDestinationWizardModel is required");
|
||||
}
|
||||
else
|
||||
{
|
||||
TransferDestination? transferDestination = JObject.Parse(SerializedTransferDestinationModel.GetRawText()).ToObject<TransferDestination>();
|
||||
TransferDestination? transferDestination = JObject.Parse(serializedTransferDestinationModel.GetRawText()).ToObject<TransferDestination>();
|
||||
|
||||
if (transferDestination != null)
|
||||
{
|
||||
|
|
@ -102,6 +102,8 @@ namespace TIAMWebApp.Server.Controllers
|
|||
Console.WriteLine($"TransferDestination to be created: {transferDestination.AddressId}");
|
||||
Console.WriteLine($"TransferDestination to be created: {transferDestination.Name}");
|
||||
Console.WriteLine($"TransferDestination to be created: {transferDestination.Price}");
|
||||
Console.WriteLine($"TransferDestination to be created: {transferDestination.Price2}");
|
||||
Console.WriteLine($"TransferDestination to be created: {transferDestination.Price3}");
|
||||
Console.WriteLine($"TransferDestination to be created: {transferDestination.PriceType}");
|
||||
Console.WriteLine($"TransferDestination to be created: {transferDestination.AddressString}");
|
||||
Console.WriteLine($"TransferDestination to be created: {transferDestination.Description}");
|
||||
|
|
@ -125,10 +127,10 @@ namespace TIAMWebApp.Server.Controllers
|
|||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
[Route(APIUrls.UpdateTransferDestinationRouteName)]
|
||||
public async Task<IActionResult> UpdateTransferDestination([FromBody]JsonElement SerializedTransferDestinationModel)
|
||||
public async Task<IActionResult> UpdateTransferDestination([FromBody]JsonElement serializedTransferDestination)
|
||||
{
|
||||
Console.WriteLine("UpdateTransferDestination called!");
|
||||
if (string.IsNullOrEmpty(SerializedTransferDestinationModel.GetRawText()))
|
||||
if (string.IsNullOrEmpty(serializedTransferDestination.GetRawText()))
|
||||
{
|
||||
Console.WriteLine("Bad request!");
|
||||
return BadRequest("SerializedTramsferDestinationWizardModel is required");
|
||||
|
|
@ -136,8 +138,8 @@ namespace TIAMWebApp.Server.Controllers
|
|||
else
|
||||
{
|
||||
Console.WriteLine("Serialized model not empty!");
|
||||
TransferDestination? transferDestination = JObject.Parse(SerializedTransferDestinationModel.GetRawText()).ToObject<TransferDestination>();
|
||||
Console.WriteLine($"TransferDestination to be updated: {SerializedTransferDestinationModel.GetRawText()}");
|
||||
TransferDestination? transferDestination = JObject.Parse(serializedTransferDestination.GetRawText()).ToObject<TransferDestination>();
|
||||
Console.WriteLine($"TransferDestination to be updated: {serializedTransferDestination.GetRawText()}");
|
||||
Console.WriteLine($"TransferDestination to be updated: {transferDestination.AddressString}");
|
||||
|
||||
|
||||
|
|
@ -158,31 +160,33 @@ namespace TIAMWebApp.Server.Controllers
|
|||
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 price: {transferDestination.Price}");
|
||||
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 priceType: {transferDestination.PriceType}");
|
||||
Console.WriteLine($"TransferDestination to be updated new address: {transferDestination.AddressString}");
|
||||
Console.WriteLine($"TransferDestination to be updated new description: {transferDestination.Description}");
|
||||
|
||||
var dbTransferDestinationJson = _adminDal.GetTransferDestinationJsonById(transferDestination.Id);
|
||||
Console.WriteLine($"TransferDestination JSON to be updated: {dbTransferDestinationJson}");
|
||||
//var dbTransferDestinationJson = _adminDal.GetTransferDestinationJsonById(transferDestination.Id);
|
||||
//Console.WriteLine($"TransferDestination JSON to be updated: {dbTransferDestinationJson}");
|
||||
|
||||
var dbTransferDestination = JObject.Parse(dbTransferDestinationJson).ToObject<TransferDestination>();
|
||||
if (dbTransferDestination.Id != Guid.Empty)
|
||||
{
|
||||
//var dbTransferDestination = JObject.Parse(dbTransferDestinationJson).ToObject<TransferDestination>();
|
||||
|
||||
dbTransferDestination.AddressId = transferDestination.AddressId;
|
||||
dbTransferDestination.Price = transferDestination.Price;
|
||||
dbTransferDestination.PriceType = transferDestination.PriceType;
|
||||
dbTransferDestination.Name = transferDestination.Name;
|
||||
dbTransferDestination.Description = transferDestination.Description;
|
||||
dbTransferDestination.AddressString = transferDestination.AddressString;
|
||||
dbTransferDestination.Address = transferDestination.Address;
|
||||
//var dbTransferDestination = _adminDal.GetTransferDestinationById(transferDestination.Id, true);
|
||||
//if (dbTransferDestination.Id != Guid.Empty)
|
||||
//{
|
||||
// dbTransferDestination.AddressId = transferDestination.AddressId;
|
||||
// dbTransferDestination.Price = transferDestination.Price;
|
||||
// dbTransferDestination.PriceType = transferDestination.PriceType;
|
||||
// dbTransferDestination.Name = transferDestination.Name;
|
||||
// dbTransferDestination.Description = transferDestination.Description;
|
||||
// dbTransferDestination.AddressString = transferDestination.AddressString;
|
||||
// dbTransferDestination.Address = transferDestination.Address;
|
||||
|
||||
}
|
||||
|
||||
//}
|
||||
|
||||
//await _transferDestinationDal.Context.TransferDestinations.AddAsync(transferDestination);
|
||||
await _adminDal.UpdateTransferDestinationAsync(dbTransferDestination);
|
||||
return Ok(dbTransferDestination);
|
||||
await _adminDal.UpdateTransferDestinationAsync(transferDestination);
|
||||
return Ok(transferDestination);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ using System.Text.RegularExpressions;
|
|||
using System.Threading.Tasks;
|
||||
using TIAM.Core.Enums;
|
||||
using TIAM.Entities.Addresses;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAM.Resources;
|
||||
|
||||
namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
||||
|
|
@ -45,6 +45,8 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
|
||||
public PriceType PriceType { get; set; }
|
||||
|
||||
public Address Address { get; set; }
|
||||
|
||||
//[DataType("Latitude")]
|
||||
//[Display(Name = "Destination latitude")]
|
||||
//public double Latitude { get; set; }
|
||||
|
|
@ -55,30 +57,34 @@ namespace TIAMWebApp.Shared.Application.Models.ClientSide.UI.WizardModels
|
|||
|
||||
public TransferDestinationWizardModel() { }
|
||||
|
||||
public TransferDestinationWizardModel(string name, string description, string address, double price, PriceType priceType) :this(Guid.NewGuid(), name, description, address, price, priceType)
|
||||
public TransferDestinationWizardModel(string name, string description, string addressString, double price, PriceType priceType, Address address) :this(Guid.NewGuid(), name, description, addressString, price, priceType, address)
|
||||
{ }
|
||||
public TransferDestinationWizardModel(Guid id, string name, string description, string address, double price, PriceType priceType)
|
||||
public TransferDestinationWizardModel(Guid id, string name, string description, string addressString, double price, PriceType priceType, Address address)
|
||||
{
|
||||
|
||||
Id = id.ToString();
|
||||
Name = name;
|
||||
Description = description;
|
||||
AddressString = address;
|
||||
AddressString = addressString;
|
||||
Price = price;
|
||||
PriceType = priceType;
|
||||
Address = address;
|
||||
}
|
||||
|
||||
public static TransferDestination SaveToTransferDestination(TransferDestinationWizardModel model)
|
||||
=> SaveToTransferDestination(model, new TransferDestination());
|
||||
public static TransferDestination CopyToTransferDestination(TransferDestinationWizardModel model)
|
||||
=> CopyToTransferDestination(model, new TransferDestination());
|
||||
|
||||
public static TransferDestination SaveToTransferDestination(TransferDestinationWizardModel model, TransferDestination destination)
|
||||
public static TransferDestination CopyToTransferDestination(TransferDestinationWizardModel model, TransferDestination destination)
|
||||
{
|
||||
destination.Id = Guid.Parse(model.Id);
|
||||
destination.Name = model.Name;
|
||||
destination.Description = model.Description;
|
||||
destination.AddressString = model.AddressString;
|
||||
destination.Price = model.Price;
|
||||
destination.Price2 = model.Price;
|
||||
destination.Price3 = model.Price;
|
||||
destination.PriceType = model.PriceType;
|
||||
destination.Address = model.Address;
|
||||
|
||||
if (destination.Address == null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System.Net.Http.Json;
|
||||
using TIAM.Entities.TransferDestinations;
|
||||
using TIAM.Entities.Transfers;
|
||||
using TIAMWebApp.Shared.Application.Interfaces;
|
||||
using TIAMWebApp.Shared.Application.Models;
|
||||
using TIAMWebApp.Shared.Application.Models.ClientSide;
|
||||
|
|
|
|||
Loading…
Reference in New Issue