1. lingaiah T
  2. SnapDevelop
  3. Saturday, 20 February 2021 16:50 PM UTC

Dear Sir,

We are using Rest API, with PHP , If we want to create / Insert row through controller and IDatastore working fine.

But update the values in the table , still it is inserting instead of update. 

Is there any easy way to update values in the DB table?

 

Example : Controller 1. Create user ( IDatastore <> datastore)

{

///////

}

Controller 2. UpdateUser ( Idatastore <> datastore

{

I want to Update same like PB, datastore.update(). 

update function wokring fine, but instead of update the row, inserting new row and I am getting primary key violation.

 

}

 

Thanks in advance.

 

Attachments (1)
Logan Liu @Appeon Accepted Answer Pending Moderation
  1. Monday, 22 February 2021 13:37 PM UTC
  2. SnapDevelop
  3. # 1

Hi Lingaiah,

It seems that you don't pass in DataWindow standard format JSON, if yes, we don't know the row state for each row, please try to

1) Use IList<YourModel> type instead of IDataStore<YourModel> type to receive data in the UpdateUser action.

2) Use a DataStore to retrieve data.

3) Call SetModel to update each row.

https://docs.appeon.com/net_datastore/3.0/api_reference/DWNet.Data/DataStore/IDataStore_Generic/Method/SetModel.html

It works similar to DataWindow in PB.

We are already considering adding more APIs to .NET DataStore to facilitate this update by model scenario. But it still needs more time.

Regards,

Logan

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.