| PUT | /equipment/{Id} |
|---|
import 'package:servicestack/servicestack.dart';
class Equipment implements IConvertible
{
int? id;
// @required()
// @StringLength(500)
String? name;
// @StringLength(1000)
String? imageUrl;
String? description;
// @StringLength(50)
String? unit;
int? materialTypeId;
int? status;
bool? isDeleted;
DateTime? approvedAt;
int? approvedBy;
DateTime? createdAt;
int? createdBy;
DateTime? updatedAt;
int? updatedBy;
// @ignore()
String? materialTypeName;
// @ignore()
String? createdByName;
// @ignore()
String? approvedByName;
Equipment({this.id,this.name,this.imageUrl,this.description,this.unit,this.materialTypeId,this.status,this.isDeleted,this.approvedAt,this.approvedBy,this.createdAt,this.createdBy,this.updatedAt,this.updatedBy,this.materialTypeName,this.createdByName,this.approvedByName});
Equipment.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
imageUrl = json['imageUrl'];
description = json['description'];
unit = json['unit'];
materialTypeId = json['materialTypeId'];
status = json['status'];
isDeleted = json['isDeleted'];
approvedAt = JsonConverters.fromJson(json['approvedAt'],'DateTime',context!);
approvedBy = json['approvedBy'];
createdAt = JsonConverters.fromJson(json['createdAt'],'DateTime',context!);
createdBy = json['createdBy'];
updatedAt = JsonConverters.fromJson(json['updatedAt'],'DateTime',context!);
updatedBy = json['updatedBy'];
materialTypeName = json['materialTypeName'];
createdByName = json['createdByName'];
approvedByName = json['approvedByName'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'imageUrl': imageUrl,
'description': description,
'unit': unit,
'materialTypeId': materialTypeId,
'status': status,
'isDeleted': isDeleted,
'approvedAt': JsonConverters.toJson(approvedAt,'DateTime',context!),
'approvedBy': approvedBy,
'createdAt': JsonConverters.toJson(createdAt,'DateTime',context!),
'createdBy': createdBy,
'updatedAt': JsonConverters.toJson(updatedAt,'DateTime',context!),
'updatedBy': updatedBy,
'materialTypeName': materialTypeName,
'createdByName': createdByName,
'approvedByName': approvedByName
};
getTypeName() => "Equipment";
TypeContext? context = _ctx;
}
class UpdateEquipmentRequest implements IConvertible
{
int? id;
String? name;
String? imageUrl;
String? description;
String? unit;
int? materialTypeId;
UpdateEquipmentRequest({this.id,this.name,this.imageUrl,this.description,this.unit,this.materialTypeId});
UpdateEquipmentRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
imageUrl = json['imageUrl'];
description = json['description'];
unit = json['unit'];
materialTypeId = json['materialTypeId'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'imageUrl': imageUrl,
'description': description,
'unit': unit,
'materialTypeId': materialTypeId
};
getTypeName() => "UpdateEquipmentRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'etc_api.vsmlab.vn', types: <String, TypeInfo> {
'Equipment': TypeInfo(TypeOf.Class, create:() => Equipment()),
'UpdateEquipmentRequest': TypeInfo(TypeOf.Class, create:() => UpdateEquipmentRequest()),
});
Dart UpdateEquipmentRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /equipment/{Id} HTTP/1.1
Host: etc-api.vsmlab.vn
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"id":0,"name":"String","imageUrl":"String","description":"String","unit":"String","materialTypeId":0}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"id":0,"name":"String","imageUrl":"String","description":"String","unit":"String","materialTypeId":0,"status":0,"isDeleted":false,"approvedAt":"0001-01-01T00:00:00.0000000+07:06","approvedBy":0,"createdAt":"0001-01-01T00:00:00.0000000+07:06","createdBy":0,"updatedAt":"0001-01-01T00:00:00.0000000+07:06","updatedBy":0,"materialTypeName":"String","createdByName":"String","approvedByName":"String"}