Shohel
Shohel

Reputation: 3934

Get entity state before saveChange in breeze js

I am working with mvc with breeze js. when i delete some record from specific entity and when i send data to controller that for causes i need specificed deleted record and its state from JObject. I have a JObject like this

{
  "entities": [
    {
      "StageDetailID": 7,
      "EventID": 1,
      "StageNUmber": "Stage 1",
      "TypeOfStage": "Primary ",
      "Distance": "100",
      "IsRadioRoadMap": "N",
      "IsRadioCourseApproval": "N",
      "IsRadioTrafficControl": "N",
      "IsRadioPoliceAssistance": "N",
      "IsNeutralSupport": "N",
      "IsKOMQOM": "N",
      "IsSprints": "N",
      "IsFeedStations": "N",
      "IsRoadClosures": "N",
      "IsDetours": "N",
      "IsSpeedReductions": "N",
      "entityAspect": {
        "entityTypeName": "StageDetail:#EventManagement.Domain.Model",
        "defaultResourceName": "StageDetails",
        "entityState": "Deleted",
        "originalValuesMap": {},
        "autoGeneratedKey": {
          "propertyName": "StageDetailID",
          "autoGeneratedKeyType": "Identity"
        }
      }
    }
  ],
  "saveOptions": {}
}

How can i get the Entity StageDetail and Entity State from this JObject. Thanks

Upvotes: 0

Views: 352

Answers (1)

user2492312
user2492312

Reputation:

In your controller define before save entity like below

public bool BeforeSaveEntity(EntityInfo info) { } and it ill hit when ever "Save changes" method is invoked, there you delete records from your entity.

For reference go through the following link

Breeze before save entites

Upvotes: 1

Related Questions