createVendorReg function

Future<VendorReg> createVendorReg(
  1. String businessType,
  2. String vendorName,
  3. int registerOfCompanyNo,
  4. String email,
  5. String companyDescription,
  6. int introducerCode,
  7. String contactNumber,
  8. int verificationCode,
  9. String mondayCheck,
  10. String tuesdayCheck,
  11. String wednesdayCheck,
  12. String thursdayCheck,
  13. String fridayCheck,
  14. String saturdayCheck,
  15. String sundayCheck,
  16. String startBusinessHours,
  17. String endBusinessHours,
  18. String personInChargeName,
  19. String emailAddress,
  20. String password,
  21. String confirmPassword,
  22. String contactNumber2,
  23. int verificationCode2,
  24. String serviceCategory,
  25. String businessCategory,
  26. String typeOfBusiness,
  27. String countryCategory,
  28. String restaurantCategory,
  29. String typeOfFood,
  30. String address,
  31. String country,
  32. String state,
  33. String city,
  34. int postcode,
  35. String shopLatitude,
  36. String shopLongitude,
  37. String flatRate,
  38. String forFirst,
  39. String everyAdditional,
  40. String bankName,
  41. int bankAccountNo,
)

Implementation

Future<VendorReg> createVendorReg(
  String businessType,
  String vendorName,
  int registerOfCompanyNo,
  String email,
  String companyDescription,
  int introducerCode,
  String contactNumber,
  int verificationCode,
  String mondayCheck,
  String tuesdayCheck,
  String wednesdayCheck,
  String thursdayCheck,
  String fridayCheck,
  String saturdayCheck,
  String sundayCheck,
  String startBusinessHours,
  String endBusinessHours,
  String personInChargeName,
  String emailAddress,
  String password,
  String confirmPassword,
  String contactNumber2,
  int verificationCode2,
  String serviceCategory,
  String businessCategory,
  String typeOfBusiness,
  String countryCategory,
  String restaurantCategory,
  String typeOfFood,
  String address,
  String country,
  String state,
  String city,
  int postcode,
  String shopLatitude,
  String shopLongitude,
  String flatRate,
  String forFirst,
  String everyAdditional,
  String bankName,
  int bankAccountNo,
) async {
  HttpOverrides.global = new MyHttpOverrides();
  final response = await http.post(
    //Uri.parse('https://172.30.1.10:45455/api/VendorRegModels'),
    Uri.parse('https://192.168.1.106:45455/api/Authenticate/VendorReg'),
    headers: <String, String>{
      'Content-Type': 'application/json; charset=UTF-8',
    },
    body: jsonEncode(<String, String>{
      'businessType': businessType, //
      'vendorName': vendorName,
      'registerOfCompanyNo': registerOfCompanyNo.toString(),
      'email': email,
      'companyDescription': companyDescription,
      'introducerCode': introducerCode.toString(),
      'contactNumber': contactNumber,
      'verificationCode': verificationCode.toString(),
      'mondayCheck': mondayCheck, //
      'tuesdayCheck': tuesdayCheck, //
      'wednesdayCheck': wednesdayCheck, //
      'thursdayCheck': thursdayCheck, //
      'fridayCheck': fridayCheck, //
      'saturdayCheck': saturdayCheck, //
      'sundayCheck': sundayCheck, //
      'startBusinessHours': startBusinessHours, //
      'endBusinessHours': endBusinessHours, //
      'personInChargeName': personInChargeName,
      'emailAddress': emailAddress,
      'password': password,
      'confirmPassword': confirmPassword,
      'contactNumber2': contactNumber2,
      'verificationCode2': verificationCode2.toString(),
      'serviceCategory': serviceCategory, //
      'businessCategory': businessCategory, //
      'typeOfBusiness': typeOfBusiness, //
      'countryCategory': countryCategory, //
      'restaurantCategory': restaurantCategory, //
      'typeOfFood': typeOfFood, //
      'address': address,
      'country': country, //
      'state': state, //
      'city': city, //
      'postcode': postcode.toString(),
      'shopLatitude': shopLatitude,
      'shopLongitude': shopLongitude,
      'flatRate': flatRate,
      'forFirst': forFirst,
      'everyAdditional': everyAdditional,
      'bankName': bankName, //
      'bankAccountNo': bankAccountNo.toString(),
    }),
  );

  if (response.statusCode == 201) {
    // If the server did return a 201 CREATED response,
    // then parse the JSON.
    return VendorReg.fromJson(jsonDecode(response.body));
  } else {
    // If the server did not return a 201 CREATED response,
    // then throw an exception.
    throw Exception('Failed to create vendor.');
  }
}