床:フロア= {ID:0、名前: ""、 floorNumber:0、addressNumber: ""、floorTypeid:0}; floorUnit:FloorUnit = {id:0、floorID:0、unitID:0、addressNumber: ''、unitCost:0、standardPrice:0、taxTermid:0、imageUrl: ''、planUrl: ''、isAvailable:true、isTemperoryBooking :false、isNotReleased:false};
const floorUnitAddURL = "api/floorunit/AddFloorUnit";
// AddFloorUnit(){ IF(this.validationService.Validate(this.floorUnitForm、this.floorUnitFormErrors、this.floorUnitValidationMessages))
{を次のように配列することにより、同じPOSTメソッドでは2つのクラスオブジェクトを渡すことができ
this.apiService.post(floorUnitAddURL, [this.floorUnit, this.floor], true).subscribe(
res => {
var data: any = res;
if (data && data.status.success) {
this.notificationService.NotifyError("Success", data.status.displayMessage, "success");
//this.ResetPropertyForm();
}
else
this.notificationService.NotifyError("Error", data.status.displayMessage, "warning");
},
err => {
this.notificationService.NotifyError("Error", "Error Occured.", "warning");
});
}
};
とWeb APIの方法で
を持つ2つの別個のパラメータ[HttpPost( "AddFloorUnit")] 公共化するJsonResultポスト([FromBody] FloorUnitDTO floorUnit、[FromBody] FloorDTO床) { try { Floor updateFloor = Mapper.Map(floor); Proxy.SetBaseEntityProperties(Request、updateFloor、true); _floorService.UpdateFloor(updateFloor);
FloorUnit newfloorUnit = Mapper.Map<FloorUnit>(floorUnit);
Proxy<FloorUnit>.SetBaseEntityProperties(Request, newfloorUnit);
_floorUnitService.AddFloorUnit(newfloorUnit);
return Json(ErrorHandle<FloorUnit>.GetSuccessMessage(null));
}
catch (Exception ex)
{
Log4netLogger<FloorUnit>.Error(Constants.ExceptionPolicy.BusinessLogic, ex);
return Json(ErrorHandle<FloorUnit>.GetInsertErrorMessage(ErrorCodes.FloorUnitInsertError, typeof(FloorUnit).Name));
}
}
'this.http.post( '/ Account/Login'、JSON.stringify([this.returnUrl、this.email]))。subscribe();' –