Base solution for your next web application

Activities of "rferrari"

Sorry, totally silly question as it was written.

The point is about changing language.

When you have front end application and you change language you are redirected to home page, but you are still logged in.

When you remove front end application and you reroute on login page in RouteConfig.cs, if you cahnge language you are sent to the login page.

Is there a way to be rerouted to the current page after language change?

Thanks

I am ok with the indication for self registration and the use of subdomain.

The other issue is related to the removal of front line application. I close this issue and open another one.

Thanks

OK I reviewed the code. Of course before login I cannot know the tenant but for subdomain url. If that is not implemented there is no way to know the tenant before login. As user registration and email activation are tenant settings they cannot be detected before login in this case.

Do you have any hint for the other issue I mentioned? Thanks

Thanks I will work on this base.

I also followed your indication on how to remove front end application and now each time I change language I have to log in again. Is that related to your indication? Thanks in advance

Perfect!

Changed:

public AspNetZeroAbpSession(IMultiTenancyConfig multiTenancy) 
            : base(multiTenancy)
        {

        }

to:

public AspNetZeroAbpSession(
    IPrincipalAccessor principalAccessor,
    IMultiTenancyConfig multiTenancy,
    ITenantResolver tenantResolver,
    IAmbientScopeProvider<SessionOverride> ambientScopeProvider)
    : base(principalAccessor, multiTenancy, tenantResolver, ambientScopeProvider)
{

}

and it works!

Thanks for your prompt reply!

I am working on a single project, also if I created multiple copies of it in the past.

Now it works this way. First build, required access, ko; stop express server, buld again ok, no need for access.

Hi,

now I discovered that I do not need to restart Visual Studio. It sufficient to stop the local web server. Something dirty is around. When I publish the solution everything is ok, so it is in the local web chain. I can live with that currently... I will try to understand.

I cleaned the browser cache multiple times but no avail.

Regards

By the way, when I close and restart Visual Studio and build the solution the system do not even ask me to log in! I am already in.

To share what I did this is my app service now:

[AbpAuthorize(AppPermissions.Pages_Tenant_Partners_CreatePartner)]
        public async Task EditPartner(EditPartnerInput input)
        {
            var partner = input.MapTo<Partner>();
            var phones = input.Phones.MapTo<List<Phone>>();
            var phonesToDelete = input.DeletedPhones.MapTo<List<Phone>>();
            var phonesToAdd = input.AddedPhones.MapTo<List<Phone>>();
            var query = await _partnerRepository.UpdateAsync(partner);
            await CurrentUnitOfWork.SaveChangesAsync();

            foreach (var phoneToAdd in phonesToAdd)
            {
                await _phoneRepository.InsertAsync(phoneToAdd);
                // await CurrentUnitOfWork.SaveChangesAsync();
            }
            foreach (var phone in phones)
            {
                var phoneToUpdate = await _phoneRepository.GetAsync(phone.Id);
                phone.MapTo(phoneToUpdate);
                await _phoneRepository.UpdateAsync(phoneToUpdate);
            }
            foreach (var phoneToDelete in phonesToDelete)
            {
                await _phoneRepository.DeleteAsync(phoneToDelete.Id);
            }
        }

This the Dto:

using Abp.AutoMapper;
using Abp.Application.Services.Dto;

namespace stake.Partners.Dto
{
    [AutoMapTo(typeof(Partner))]
    public class EditPartnerInput : IInputDto
    {
        public int Id { get; set; }

        public string Name { get; set; }

        public string Surname { get; set; }

        public PartnerPhoneDto[] Phones { get; set; }

        public PartnerPhoneDto[] DeletedPhones { get; set; }

        public PartnerPhoneDto[] AddedPhones { get; set; }
    }
}

I finally solved it!

First I discovered that it was not a problem of this piece of code alone:

foreach (var phone in phones)
            {
                if (phone.Id == 0)
                {
                    {
                        var currentPartner = _partnerRepository.Get(partner.Id);
                        currentPartner.Phones.Add(phone);
                      //  await CurrentUnitOfWork.SaveChangesAsync();
                    }
                }

but of the interference with previous partner update:

var query = await _partnerRepository.UpdateAsync(partner);

each of the actions alone worked well, but they did not work together, I do not really know why, maybe because of interference between the collection partner.Phones and the separate addition of phones.

When I discovered that I took the following actions:

  1. Added a line to the Dto for added phones as I did for deleted ones
  2. Modified the cshtml and the js so that each added phone goes in an addedPhones list and not on the original vm.partner.phones

In that way everything works I can add as many phones I want, delete as many I want, edit as many I want and also edit the partner name and surname on the same page and everything get updated.

Thanks for the support!

Showing 11 to 20 of 30 entries