Thursday, 31 March 2022

Angular x-www-form-urlencoded post

 post method with xxx-formurl encoded and token headers

postUserRole(obj: any) {
    const myheader = new HttpHeaders().set('Content-Type', 'application/x-www-form-urlencoded')
    const httpOptions = {
      headers: new HttpHeaders({
        'Content-Type': 'application/x-www-form-urlencoded',
        'Authorization': `Bearer ${this.token}`
      })
    };
   

    let body = new HttpParams();
    body = body.set("RoleId", "0");
    body = body.set("RoleName", "apptest");
    body = body.set("Description", "testing");
    body = body.set("Status", "active");
    body = body.set("RecordsCount", "0");
    body = body.set("ActiveStatus", "0");
    body = body.set("DuplicateRoleName", "");
    body = body.set("SwitchPermission", "false");
    body = body.set("MasterpermissionStatus", "true");



    return this.httpClient.post<any>("https://dev.psplhyd.com/Crmangular13-API/api/1/userrolesapi", body, httpOptions).pipe(catchError(this.errorHandler))





  }
https://entityframeworkcore.com/knowledge-base/59151584/how-to-execute-stored-procedure-for-multiple-parameters-using-fromsqlinterpolated-in-ef-core-3-0-
https://stackoverflow.com/questions/51605542/angular-6-http-post-request-with-x-www-form-urlencoded-data

install issues

 1.for first time in a system to install npm and run ng s get this error

ng : The term 'ng' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling   

of the name, or if a path was included, verify that the path is correct and try again.

At line:1 char:1

+ ng -v

resolve using this cmd

set-ExecutionPolicy RemoteSigned -Scope CurrentUser

Wednesday, 30 March 2022

flutter

 https://flutterawesome.com/an-app-enable-kids-between-from-one-to-five-years-to-learn-with-fun-the-basic-concepts-for-thier-age/


The FlatButton, RaisedButton and OutlineButton widgets have been replaced by TextButton, ElevatedButton, and OutlinedButton respectively

https://docs.flutter.dev/release/breaking-changes/buttons


cmds: flutter creaste appnamefirstlettersmall

flutter run




file upload

 https://karthiktechblog.com/aspnetcore/how-to-upload-a-file-with-net-core-web-api-3-1-using-iformfile#:~:text=To%20upload%20a%20single%20file,single%20file%20as%20a%20parameter.

core file upload

Saturday, 26 March 2022

AVM install issues

 install this HAXM failed even hyver-v cheked in window properties also.
finaly resolved 

>goto bios settings press f10 and goto tab virtual enable it then it is installed successfully


npm cmds

 ng g m  component--route  component --module app

npm install --save @angular/animations
npm install --save @angular/material @angular/cdk

cross issue

  public void ConfigureServices(IServiceCollection services)

{

// Add Cors

services.AddCors(o => o.AddPolicy("MyPolicy", builder =>

{

builder.AllowAnyOrigin()

   .AllowAnyMethod()

   .AllowAnyHeader();

}));


services.AddDistributedMemoryCache();

//services.AddSwaggerGen();

//services.AddCors(c => { c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin()); });

services.AddControllers().AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null);


}

------------

                              app.UseRouting();

// Enable Cors

app.UseCors("MyPolicy");

-----------


in controller

[EnableCors("MyPolicy")]

public class ApiController : ControllerBase


Best ui design