CreateServiceProvider improvements, fixes
This commit is contained in:
parent
e08a005d2b
commit
3263fe541f
|
|
@ -79,6 +79,9 @@ namespace TIAM.Database.DbContexts.Admins
|
|||
|
||||
new EmailMessageEntityTypeDefaultConfigurations().Configure(modelBuilder.Entity<EmailMessage>());
|
||||
|
||||
modelBuilder.Entity<Company>().Navigation(e => e.Profile).AutoInclude(true);
|
||||
modelBuilder.Entity<Company>().HasOne(x => x.Profile).WithOne().OnDelete(DeleteBehavior.Cascade);
|
||||
|
||||
//modelBuilder.Entity<UserProductToCar>().Ignore(x => x.Id);
|
||||
//modelBuilder.Entity<Car>().Ignore(x => x.Id);
|
||||
////modelBuilder.Entity<UserProductToCars>().Ignore(x => x.Cars);
|
||||
|
|
|
|||
|
|
@ -7,4 +7,18 @@ namespace TIAM.Entities.Addresses;
|
|||
[Table(nameof(Address))]
|
||||
public class Address : AcAddress, IAddress
|
||||
{
|
||||
public Address() : base()
|
||||
{ }
|
||||
|
||||
public Address(Guid id) : base(id)
|
||||
{
|
||||
}
|
||||
|
||||
public Address(Guid id, string? addressText) : base(id, addressText)
|
||||
{
|
||||
}
|
||||
|
||||
public Address(Guid id, double? latitude, double? longitude, string? addressText) : base(id, latitude, longitude, addressText)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -7,5 +7,12 @@ namespace TIAM.Entities.Profiles;
|
|||
[Table(nameof(Profile))]
|
||||
public class Profile : AcProfile<Address>, IProfile<Address>
|
||||
{
|
||||
|
||||
public Profile() : base()
|
||||
{ }
|
||||
|
||||
public Profile(Guid id) : base(id)
|
||||
{ }
|
||||
|
||||
public Profile(Guid id, string name) : base(id, name)
|
||||
{ }
|
||||
}
|
||||
|
|
@ -152,10 +152,7 @@ namespace TIAMSharedUI.Pages.Components
|
|||
//the following line creates a lambda expression that returns the value of the property
|
||||
var lambda = Expression.Lambda(typeof(Func<>).MakeGenericType(property.PropertyType), access);
|
||||
|
||||
_logger.DetailConditional($"{property.Name}, {property.GetType().FullName}");
|
||||
_logger.DetailConditional(lambda.ToString());
|
||||
|
||||
_logger.DetailConditional($"lambda: {lambda.ToString()}");
|
||||
_logger.DetailConditional($"{property.Name}, {property.GetType().FullName}; lambda: {lambda.ToString()}");
|
||||
|
||||
layoutItemBuilder.OpenElement(i++, "div");//open div
|
||||
layoutItemBuilder.AddAttribute(i++, "id", stepId.ToString());
|
||||
|
|
@ -508,7 +505,7 @@ namespace TIAMSharedUI.Pages.Components
|
|||
layoutItemBuilder.CloseElement();
|
||||
|
||||
|
||||
_logger.DetailConditional($"loop {k}, length: {length}, formSteps: {FormSteps.Count} ");
|
||||
//_logger.DetailConditional($"loop {k}, length: {length}, formSteps: {FormSteps.Count} ");
|
||||
k++;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,6 +14,8 @@ using TIAM.Entities.Transfers;
|
|||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using TIAM.Entities.Addresses;
|
||||
using TIAM.Entities.Profiles;
|
||||
|
||||
namespace TIAMWebApp.Server.Controllers
|
||||
{
|
||||
|
|
@ -79,6 +81,10 @@ namespace TIAMWebApp.Server.Controllers
|
|||
GlobalLogger.Info($@"ServiceProvider to be created: {id}, {name}, {ownerId}");
|
||||
Company toCreate = new Company(id, name, ownerId, Guid.NewGuid());
|
||||
toCreate.CommissionPercent = commissionRate;
|
||||
|
||||
toCreate.SetProfile(new Profile(Guid.NewGuid(), toCreate.Name));
|
||||
toCreate.Profile.SetAddress(new Address(Guid.NewGuid(), "Controller CreateServiceProvider; address text..."));
|
||||
|
||||
var result = await _adminDal.CreateServiceProviderAsync(toCreate);
|
||||
if (!result)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue