Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "sampath"

Hi,

I need to develop full featured Restaurant app using Zero and PostgreSQL db. My customer gave this requirement. Please let me know is that possible with Zero and any guidance too. Thanks in advance.

a. Super Admin : This user does have the full access to the system, including all tenants.

b. Account Manager : This user does have full access to selected tenants. Super admin will create the profile for account manager. Super admin will assign tenants to account manager. Once it is assigned, the account manager gains the full access to those tenants.

c. Restaurant Owner : This user does have full access to only one tenant (Own tenant). A request to create a restaurant (tenant) comes from restaurant owner. Following the approval by super admin/account manager, the restaurant owner gains the full access.

d. Restaurant Staff : This user does have limited access to selected tenants. Staff will gain access to tenants in the same way as delivery person.

e. Delivery Person : This user does have very limited access to selected tenants. A delivery person can work with multiple tenants. However if he has registered with the system, he will then be assigned to a tenant. Please note that he does not have register again to access another tenant. If he has to access another tenant, he must be given access to the relevant tenant by the restaurant owner/Account manager/Super admin

f. Registered Customers : Once a customer has registered with one restaurant, he does not have to register again to another restaurant to place an order. Single registration allows himself to use other tenants too.

Hi,

Doc: https://aspnetboilerplate.com/Pages/Documents/EF-Core-PostgreSql-Integration

But, You don't need this now:

To prevent EF Core from calling Program.BuildWebHost(), rename BuildWebHost. For example, change it to InitWebHost.

This is misleading:

Delete the *.EntityFrameworkCore/Migrations folder, because Npgsql.EntityFrameworkCore.PostgreSQL will add some of its own configuration to work with Entity Framework Core.

It should be like this:

Delete the *.EntityFrameworkCore/Migrations folder's Migration classes. Don't delete Seed folder. Because Npgsql.EntityFrameworkCore.PostgreSQL will add some of its own configuration to work with Entity Framework Core.

Hi,

We need to set up CI/CD on Azure DevOps. Can you give any guidance for that? We'll use Asp.net Core/Angular and Xamarin projects for CI/CD workflow. Any guidance will be highly appreciated.

I can see this for Asp.net Core/ MVC project: https://docs.aspnetzero.com/documents/aspnet-core-mvc/latest/Setting-Up-an-Azure-Pipeline-Mvc-Core

But I cannot see this for Core/ Angular projects. Why? i.e. Setting Up an Azure Pipeline

Hi,

I have implemented Redis cache as shown below.But now on test method where it shows all the actual data on the database instead of the seed data.Because data was cached.Could you tell me how to avoid this situation? Thanks.

Note: I'm using Asp.net Zero

BankAppService.cs

public async Task<ListResultDto<BankListDto>> GetAllBanksAsync()
        {
            var cache = RedisConnectorHelper.Connection.GetDatabase();
            var values = RedisConnectorHelper.GetCache<BankListDto>(AppConsts.Banks, cache, o => o.Name);//get cache
            if (values != null) return values;

            var banks = await _bankRepository.GetAllListAsync();
            RedisConnectorHelper.SetCache<BankListDto, Bank>(AppConsts.Banks, banks, cache, o => o.Name);//set cache
            return new ListResultDto<BankListDto>(banks.OrderBy(o => o.Name).MapTo<List<BankListDto>>());
        }

Test method

BankAppServiceTests.cs

[Fact]
public async Task Test_GetAllBanksAsync()
 {
 //Act
var banks = await _bankAppService.GetAllBanksAsync();//here it shows over 7000+ records.which are on my db.But it must be just 4 records on the seed data no?

//Assert
banks.Items.ShouldContain(t => t.Name == "EquiCredit Corp of NY");
}

Seed method

namespace My.Company.Migrations.Seed
{
    public class InitialBanksCreator
    {
        private readonly IpDbContext _context;

        public InitialBanksCreator(IpDbContext context)
        {
            _context = context;
        }

        public void Create()
        {
            var object1 = _context.Banks.FirstOrDefault(p => p.Name == "EquiCredit Corp of NY");
            if (object1 == null)
            {
                _context.Banks.Add(
                    new Bank
                    {
                        Name = "EquiCredit Corp of NY",
                        TenantId = 2,
                    });
                _context.SaveChanges();
            }

            var object2 = _context.Banks.FirstOrDefault(p => p.Name == "Manufacturers & Traders Trust");
            if (object2 == null)
            {
                _context.Banks.Add(
                   new Bank
                   {
                       Name = "Manufacturers & Traders Trust",
                       TenantId = 2,
                   });
                _context.SaveChanges();
            }

            var object3 = _context.Banks.FirstOrDefault(p => p.Name == "Chemical Mtg Co");
            if (object3 == null)
            {
                _context.Banks.Add(
                   new Bank
                   {
                       Name = "Chemical Mtg Co",
                       TenantId = 2,
                   });
                _context.SaveChanges();
            }

            var object4 = _context.Banks.FirstOrDefault(p => p.Name == "Union Planters Bank");
            if (object4 == null)
            {
                _context.Banks.Add(
                   new Bank
                   {
                       Name = "Union Planters Bank",
                       TenantId = 2,
                   });
                _context.SaveChanges();
            }
        }
    }
}

Hi,

My client wants to purchase a latest ng-2 version of ASP.netZero. But we have developed an app using ng-1 version of ASP.netZero. So we need to migrate that code base to ng-2 version.So can you tell me the best possible way to do that? Thanks.

Hi,

ng-2 version app.

I can compile server project properly.But when I run it where it gives below error.Can you tell me why? Thanks.

Question

Hi,

I have a project requirement as shown below.Please tell me is that possible with the ASP.netZero ng-2 version.

On this application:

  1. Tenants = Projects

  2. We need to create users globally.The user accounts and profile information needs to be stored globally.

The user needs to create a user account if he does not have a user account already. If he has already a user account, he can use this account for all projects (Tenants).

User Profile:

Every user can edit his profile data such as his user profile picture and etc. This information is shared across all projects (Tenants).

This functionality is quite similar to the Git hub.

On Git hub:

They can store users globally == Our app also needs this feature

Repository == Projects on our app

So please tell me is this possible with the ASP.netZero architecture? Thanks.

Hi,

Can you please tell me how to publish the ng-2 version app ? I need to publish client and server separately. Please share a doc if you have about mentioning this. Thanks.

Hi,

Abp ng-2 version :

Can you tell me why tenantId and user throws exception even though I have tested this as loged in user ? Thanks.

.Web.Core ---> DocumentUploadController.cs

[Route("api/[controller]/[action]")]
     [Consumes("application/json", "application/json-patch+json", "multipart/form-data")]
     public class DocumentUploadController : CpcpControllerBase
    {
     
        [HttpPost]
        public async Task<string> AddDocument(IFormFile file, [FromQuery]string doctype)
        {
            var stream = file.OpenReadStream();
            var name = file.FileName;
       
            var user = AbpSession.GetUserId(); //show exception here
            var tenantId = AbpSession.GetTenantId(); //show exception here
}
}

drawings.component.ts

initFileUploader(): void {
        let self = this;
        self.uploader = new FileUploader({ url: AppConsts.remoteServiceBaseUrl + '/api/DocumentUpload/AddDocument?doctype=Drawings' });
        self.uploaderOptions.authToken = 'Bearer ' + self.tokenService.getToken();
        self.uploader.onAfterAddingFile = (file) => {
            file.withCredentials = false;
        };
    }

Exception :

Hi

I'm using ABP ng-2 version.

I'm using ng2-file-upload as shown below.But it gives me below error when I tried to upload a image.Web api method is working fine with the Postman.But when I try to use with app it gives below error.Please give me a feedback.Thanks.

Component :

import { Component, Injector } from '@angular/core';
import { TenantDashboardServiceProxy } from '@shared/service-proxies/service-proxies';
import { AppComponentBase } from '@shared/common/app-component-base';
import { appModuleAnimation } from '@shared/animations/routerTransition';
import { FileUploader, FileUploaderOptions, Headers } from 'ng2-file-upload';
import { AppConsts } from '@shared/AppConsts';
import { TokenService } from '@abp/auth/token.service';


@Component({
    templateUrl: './drawings.component.html',
    animations: [appModuleAnimation()]
})

export class DrawingsComponent extends AppComponentBase {

    constructor(injector: Injector, private _tokenService: TokenService) {
        super(injector);
    }
    
    uploader: FileUploader = new FileUploader({
        url: AppConsts.remoteServiceBaseUrl + '/api/DocumentUpload/AddDocument',
        authToken: 'Bearer ' + this._tokenService.getToken()
    });
    
    hasBaseDropZoneOver: boolean = false;
    hasAnotherDropZoneOver: boolean = false;

    fileOverBase(e: any): void {
        this.hasBaseDropZoneOver = e;
    }

    fileOverAnother(e: any): void {
        this.hasAnotherDropZoneOver = e;
    }

}

Error :

XMLHttpRequest cannot load <a class="postlink" href="http://localhost:22742/api/DocumentUpload/AddDocument">http://localhost:22742/api/DocumentUpload/AddDocument</a>. Response to preflight request doesn't pass access control check: Credentials flag is 'true', but the 'Access-Control-Allow-Credentials' header is ''. It must be 'true' to allow credentials. Origin 'http://localhost:4200' is therefore not allowed access. vendor.bundle.js:147481 XHR failed loading: POST "http://localhost:22742/api/DocumentUpload/AddDocument".

Showing 1 to 10 of 62 entries