Thursday, 26 May 2022

Asp.net core Proc Imp

 >>most importent StroedProcedure resolved today by using

keyless model it is very importent thing for dbcontext

>> #region Keyless

            modelBuilder.Entity<TotalReportCOunt>()
                .HasNoKey();
            #endregion

now u can access model without key also it is very importent one.

project: Advertice APi auth upload

Friday, 20 May 2022

popupwithoutcomponent

 <button (click)="openDialog(template)">Open my dialog</button>

<ng-template #template>
 <h1>This is a message</h1>
</ng-template>

Component.ts

import {MatDialog, MatDialogRef} from '@angular/material/dialog';


constructor(dialog: MatDialog) {}

openDialog(templateRef) {
  let dialogRef = this.dialog.open(templateRef, {
   width: '300px'
 });
}

Wednesday, 18 May 2022

country code extention

 angular phonenumber with extention sample code

https://stackblitz.com/edit/ngx-phone-num-with-country-code?file=src%2Fapp%2Fapp.component.ts


Saturday, 14 May 2022

dynamic carsoule

   <div class="container">

                        <div class="row">
                            <div class="col-sm-5">
                                <div id="consulting-carousel" class="carousel slide" data-ride="carousel">
                                    <div class="carousel-inner" role="listbox">
                                        <div class="item " *ngFor="let item of imgList;let index = index;let isFirst = first" [ngClass]="{active:isFirst}" >
                                            <span class="consulting-caption">
                                                <img [src]="item.name"  class="d-block w-100" alt="image">
                                             
                                                </span>
                                        </div>
                                       
                                    </div>
                                    <ol class="carousel-indicators">
                                        <li data-target="#consulting-carousel" *ngFor="let item of imgList;let index = index;let isFirst = first" [ngClass]="{active:isFirst}" >
                                            <img [src]="item.name" alt="image"></li>
                                       

                                    </ol>
                                </div>
                         

                            </div>
                        </div>

                    </div>

ts:

 this.imgList=[
      {name:"assets/images/consult/c1.jpg"},
      {name:"assets/images/consult/c2.jpg"},
      {name:"assets/images/consult/c3.jpg"},
      {name:"assets/images/consult/c4.jpg"}
  ]


https://stackblitz.com/edit/angular-carousel-example-cwnzre?file=src%2Fapp%2Fcarousel%2Fcarousel.component.html

Thursday, 12 May 2022

angular hmtl in production issue

 angular project while publication. getting the 404 issue so i have did following changes.

i changed base href in index.html

<base href="/">

to 
<base href="./">
by doing this issue resolved

asp.net web api session

 session hanling in web api 2 

 protected void Application_PostAuthorizeRequest()

        {

            HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);


        }


give this method global.cs 

Tuesday, 10 May 2022

ASp.net core context execute proc issue

while executing proc getting below issue.

 The SqlParameterCollection only accepts non-null SqlParameter type objects, not String objects

due to wrong namespace

using System.Data.SqlClient to using Microsoft.Data.SqlClient

imp





Tuesday, 3 May 2022

agnular 13 Issues

how to declare array in angular 13

const result : string[] = [];

if array=[]
array.push doesnot work so declare like above.

Sunday, 1 May 2022

asp.net core

 https://stackoverflow.com/questions/63595993/how-to-pass-multiple-parameters-to-stored-procedure-on-net-core-3-1

asp.net core sp imp


https://ayende.com/blog/3955/repository-is-the-new-singleton;


if pass parameter value null pass like this

 var parameters = new List<SqlParameter>();


            if (string.IsNullOrEmpty(payload.Code) == false)

                parameters.Add(new SqlParameter("@code", payload.Code));

            else

                parameters.Add(new SqlParameter("@code", DBNull.Value));



web api 2 to core:

System.Data.DbType to convert 

System.Data.SqlDbType asp.net core


Severity Code Description Project File Line Suppression State

Error CS0029 Cannot implicitly convert type 'System.Collections.Generic.List<WebApplication11.Models.Address>' to 'Microsoft.AspNetCore.Mvc.ActionResult<WebApplication11.Models.Address>' FMSApiCore D:\Logicon\Angular\FMSAsp.NetCoreAPI\WebApplication11\Controllers\AddressesController.cs 61 Active


where condition issues

mostly getting issue due to list return in this change.
  public async Task<ActionResult<IEnumerable<Address>>> GetAddress(long id)

model class as folde with IEnumerable imp this one



Error CS1061 'Task<IEnumerable>' does not contain a definition for 'Where' and no accessible extension method 'Where'


  IEnumerable <Member>  members= (IEnumerable<Member>)_memberRepository.GetMembers();
            var result=    members.Where(x => x.MemberType == memberType && x.IsActive == true).ToList();

c#

 https://github.com/dcyuksel/Result