second commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import '../../../../Model/Request/Location/Addlocation/Addlocationrequest.dart';
|
||||
import '../../../../Model/Response/Location/Addlocation/Addlocationresponse.dart';
|
||||
|
||||
class AddLocationProvider{
|
||||
Future<AddLocationResponse?> addLocation(AddLocation data,String urldata,) async {
|
||||
AddLocationResponse? addLocationResponse;
|
||||
try {
|
||||
|
||||
final url = Uri.parse(urldata);
|
||||
|
||||
final response = await post(url,
|
||||
body: json.encode(data),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
// 'Authorization': '$token',
|
||||
});
|
||||
|
||||
print('addLocationResponseresponsebody ${response.body}');
|
||||
print('addLocationResponsedatatoJson ${data.toJson()}');
|
||||
print('addLocationResponseresponseorderdate ${data.tenantid}');
|
||||
print('addLocationResponseresponsetenantid ${data.locationid}');
|
||||
print('addLocationResponseresponsemoduleid ${data.moduleid}');
|
||||
print('addLocationResponseresponsepartnerid ${data.partnerid}');
|
||||
|
||||
|
||||
|
||||
// print('headerssssssssss ${response.headers}');
|
||||
print('addLocationResponseurlsssssssssss ${urldata.toString()}');
|
||||
Map<String, dynamic> parsedJson = json.decode(response.body.toString());
|
||||
|
||||
addLocationResponse = AddLocationResponse.fromJson(parsedJson);
|
||||
print('createOrderinprovider $addLocationResponse');
|
||||
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
print("error");
|
||||
}
|
||||
return addLocationResponse;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
|
||||
import '../../../../Model/Response/Tenantlocation/Getlocationbyidresponse.dart';
|
||||
|
||||
|
||||
class GetLocationsProvider{
|
||||
|
||||
Future<GetLocationByTenantId?> getLocationById(String urldata) async {
|
||||
GetLocationByTenantId? getLocationById;
|
||||
try {
|
||||
|
||||
final url = Uri.parse('$urldata',);
|
||||
|
||||
final response = await http.get(url,
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
// 'Authorization': '$token',
|
||||
},
|
||||
);
|
||||
print('GetLocation!!!!!!!!${response.body}');
|
||||
print('GetLocationproviderurldata!!!!!!!!${urldata.toString()}');
|
||||
Map<String, dynamic> parsedJson = json.decode(response.body.toString());
|
||||
|
||||
getLocationById = GetLocationByTenantId.fromJson(parsedJson);
|
||||
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
print("error");
|
||||
}
|
||||
return getLocationById;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import '../../../../Model/Request/Location/Updatelocation/Updatelocationrequest.dart';
|
||||
import '../../../../Model/Response/Location/Updatelocation/Updatelocationresponse.dart';
|
||||
|
||||
class UpdateLocationProvider{
|
||||
|
||||
Future<UpdateLocationResponse?> updateLocation(UpdateLocation data,String urldata,) async {
|
||||
UpdateLocationResponse? updateLocationResponse;
|
||||
try {
|
||||
|
||||
final url = Uri.parse(urldata);
|
||||
|
||||
final response = await put(url,
|
||||
body: json.encode(data),
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json',
|
||||
// 'Authorization': '$token',
|
||||
});
|
||||
|
||||
print('updateLocationResponseresponsebody ${response.body}');
|
||||
print('updateLocationResponsedatatoJson ${data.toJson()}');
|
||||
print('updateLocationResponseresponseorderdate ${data.tenantid}');
|
||||
print('updateLocationResponseresponsetenantid ${data.locationid}');
|
||||
print('updateLocationResponseresponsemoduleid ${data.moduleid}');
|
||||
print('updateLocationResponseresponsepartnerid ${data.partnerid}');
|
||||
|
||||
|
||||
|
||||
// print('headerssssssssss ${response.headers}');
|
||||
print('CreateOrderurlsssssssssss ${urldata.toString()}');
|
||||
Map<String, dynamic> parsedJson = json.decode(response.body.toString());
|
||||
|
||||
updateLocationResponse = UpdateLocationResponse.fromJson(parsedJson);
|
||||
print('createOrderinprovider $updateLocationResponse');
|
||||
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
print("error");
|
||||
}
|
||||
return updateLocationResponse;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user