Base solution for your next web application

Activities of "oaalvarado"

Hi,

I'm using ASP.NET Zero Core MVC JQuery version is 7.0.0 with SQL Server Database. I need to access data from an Oracle Database, but can't get it to work.

I added the Oracle.EntityFrameworkCore nuget package to the EntityFrameworkCore and Web.Mvc projects. I created a connectionstring for the Oracle Database in the appsettings.json file in Web.Mvc project. Created another DbContext, DbContextconfigurer and DbContextFactory in the EntityFrameworkCore project for the Oracle Database. Added code in the PreInitialize subrutine in the EntityFrameworkCoreModule to configure the Oracle Database.

I tried to create a custom repository to query the Oracle Database, but I can't get it to connect to the database. I can't find any documentation on what to do next. Can you please provide some guidance?

Hi maliming,

The issue was with the javascript. It works now. Thanks for your help.

Hi @maliming,

I did the following as a test, created a simple View with 2 fields, added the code in controller and model to save the data from the View, but when I click the button to do the Post action, it displays the error message HTTP Error 415. I did this in a demo project, not the one I'm working on.

Hi @maliming,

The organization I work for doesn't allow the use of Teamviewer. I have Skype for Business. Is there another way to connect?

Hi @ismcagdas,

Sorry for the late response, I was out of the office last week. I enabled the Preserve log in Dev Tools and tried to Save a new port. At first I had a javascript error, the script file was not loading. I fixed this, and now I get this error in the Dev Tool Console:

POST http://localhost:62114/api/services/app/Ports/Create 415 (Unsupported Media Type)

Thanks for your help.

Hi maliming,

This is the code for the Create method in portsAppService:

    [AbpAuthorize(AppPermissions.Pages_Ports_Create)]        
    public async Task Create(CreatePortDto input)
    {
        var organization = new Organization()
        {
            Name = input.Name,
            Logo =  null, //input.Logo,
            Address = input.Address,
            Phone1 = input.Phone1,
            Phone2 = input.Phone2,
            Fax = input.Fax,
            EMail1 = input.EMail1,
            EMail2 = input.EMail2,
            Website = input.Website,
            CategoryId =  input.CategoryId,
            CountryId = input.CountryId,
            CityId = input.CityId
        };

        var result = await _organizationRepository.InsertAsync(organization);

        var port = new PortDetail()
        {
            Code = input.Code,
            Governance = input.Governance,
            OrganizationId = result.Id
        };

        var result2 = await _portDetailRepository.InsertAsync(port);
    }
   

This is the output for abp.services.

I have noticed that when I click in the Save button, the code in the portsAppService is not called. Neither the code in the Javascript. I think maybe is something with the CSHTML? This is the Create.cshtml code (I removed part of the code that is irrelevant):

@using CPMS.Authorization @using CPMS.Web.Areas.App.Models.Ports @using CPMS.Web.Areas.App.Startup

@model CreatePortViewModel @{ ViewBag.CurrentPageName = AppPageNames.Application.Ports; }

@section Scripts { <script abp-src="/view-resources/Areas/App/Views/Ports/Create.js" asp-append-version="true"></script> }

**&lt;form class=&quot;kt-form createPort-form&quot; id=&quot;CreatePortForm&quot; name=&quot;CreatePortForm&quot; role=&quot;form&quot; novalidate asp-action=&quot;Create&quot; asp-controller=&quot;Ports&quot; asp-area=&quot;App&quot; method=&quot;post&quot;&gt;**
    &lt;div class=&quot;kt-subheader kt-grid__item&quot;&gt;
        &lt;div class=&quot;kt-subheader__main&quot;&gt;
            &lt;h3 class=&quot;kt-subheader__title&quot;&gt;
                &lt;span&gt;@L("CreateNewPort")&lt;/span&gt;
            &lt;/h3&gt;
            &lt;span class=&quot;kt-subheader__separator kt-subheader__separator--v&quot;&gt;&lt;/span&gt;
            &lt;div class=&quot;kt-subheader__desc&quot;&gt;
                @*&lt;h3&gt; @Model.Code - @Model.Name &lt;/h3&gt;*@
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class=&quot;kt-subheader__toolbar&quot;&gt;
            &lt;div class=&quot;kt-subheader__wrapper&quot;&gt;
                &lt;button id=&quot;ReturnPortList&quot; class=&quot;btn btn-primary&quot;&gt;&lt;i class=&quot;fa fa-backward&quot;&gt;&lt;/i&gt; @L("PortsList")&lt;/button&gt;
               ** &lt;button id=&quot;Save&quot; type=&quot;submit&quot; class=&quot;btn btn-secondary btn-outline-secondary&quot;&gt;&lt;i class=&quot;fa fa-save&quot;&gt;&lt;/i&gt; @L("Save")&lt;/button&gt;**
                &lt;button id=&quot;SaveAndEdit&quot; type=&quot;submit&quot; class=&quot;btn btn-secondary btn-outline-secondary&quot;&gt;&lt;i class=&quot;fa fa-save&quot;&gt;&lt;/i&gt; @L("SaveAndEdit")&lt;/button&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    

When I click the submit button, it goes to this URL: http://localhost:62114/api/services/app/Ports/Create but displays the error: HTTP Error 415.

Thanks for your help.

Hi exInt,

Thanks for the code. If I understand the code correctly, it is for a modal View. But I am not using a modal View, and want to use a normal View, because in the form I have to include several datatables, and this datatables will have modal Views to add or edit data.

Also, I don't know how to fix the "HTTP Error 415". How can I specify the Content Type in the submit? I believe the correct Content Type would be "application/JSON", right?

I'm still getting error HTTP Error 415:

This is the Header info from Developer Tool:

Hi,

Remove "Trusted_Connection=True;" from the connectionString, if you are not using Windows Authentication. Looks like you are using a SQL Server user to connect to the database.

I did some searching and I think the code in in the Login.cshtml, Login.js, EmailActivation.cshtml and EmailActivation.js files is what I need to do. I'm I right Maliming?

Showing 11 to 20 of 27 entries