I am trying to update the record
but when I click on edit button then get an error
see below code:
registration.component.html
- (click)="registration()">Submit
- (click)="edit()">Edit
List Of Employee
"width: 1150px; height: 200px;" - class="ag-theme-balham"
- [rowData]="elist"
- [columnDefs]="columnDefs"
- (rowClicked)='onGridRowClicked($event)'>
- columnDefs = [
- { headerName: 'empid', field: 'empid' },
- { headerName: 'username', field: 'username' },
- { headerName: 'empaddress', field: 'empaddress' },
- { headerName: 'password', field: 'password' },
- { headerName: 'country', field: 'country' },
- {
- headerName: 'Edit',
- template: '',
- }
- ];
- onGridRowClicked(e: any) {
- if (e.event.target !== undefined) {
- let actionType = e.event.target.getAttribute("data-action-type");
- if (actionType == "edit") {
- this.rowData = this.myservice.getExistRecord(e.data.empid).subscribe((data: any) => {
- console.log("inside get data from list 1")
- if (data.message == "GetSuccess") {
- //get data from the list
- debugger
- this.txtusername = e.data.username;
- this.txtempaddress = e.data.empaddress;
- this.txtpassword = e.data.password;
- this.txtcountry = e.data.country;
- this.empid = e.data.empid;
- this.dataUpdate();
- console.log("empid", e.data.empid);
- console.log("Edit Icon Clicked");
- }
- });
- }
- else if (actionType == "delete") {
- console.log("View delete action clicked");
- }
- }
- }
- //after get the data then update a record
- dataUpdate() {
- this.myservice.editExistRecord(this.empid, this.txtusername, this.txtempaddress, this.txtpassword, this.txtcountry).subscribe((data: any) => {
- console.log("Inside editExistRecord")
- if (data.message == "UpdateSuccessfully") {
- debugger
- this.list();
- }
- else if (data.message == "UpdateSuccessfully") {
- debugger
- this.list();
- }
- });
- }
- edit() {
- this.dataUpdate();
- }
backendservice.service.ts
- //getdata from the list for update record
- public getExistRecord(empid) {
- this.url = "https://localhost:44371/emps/GetRecordForEdit?empid=" + empid;
- // this.url = "https://localhost:44371/emps/Edit?empid=" + 2013;
- console.log(this.url);
- return this.httpClient.get
( this.url); - }
- //update record
- public editExistRecord(empid,username, empaddress, password, country): Observable
{ - debugger
- //https://localhost:44371/emps/Edit?empid=2013
- this.url = "https://localhost:44371/emps/Edit?empid=" + empid + "&username=" + username + "&empaddress=" + empaddress + "&password=" + password + "&country=" + country;
- const postdata = {
- 'username': username,
- 'empaddress': empaddress,
- 'password': password,
- 'country': country,
- }
- console.log(this.url);
- return this.httpClient.put
( this.url, postdata); - }
(NetWork tabl 404 not found):
is there any issue with my webservice?
why my record is not updated
Salman BegPosted Sep 4, 2020, 5:51 AM
-------Posted Sep 5, 2020, 12:26 AM
-------Posted Sep 4, 2020, 11:12 PM
-------Posted Sep 4, 2020, 7:26 AM
Salman BegPosted Sep 4, 2020, 7:09 AM
-------Posted Sep 4, 2020, 6:03 AM