createBusinessInfo function

Future<BusinessInfo> createBusinessInfo(
  1. String contactNumber,
  2. String companyDescription,
  3. String businessStartTime,
  4. String businessFinishTime,
  5. String monday,
  6. String tuesday,
  7. String wednesday,
  8. String thursday,
  9. String friday,
  10. String saturday,
  11. String sunday,
  12. String isPublished,
)

Implementation

Future<BusinessInfo> createBusinessInfo(
    // String companyName,
    // String rocNumber,
    // String vendorEmail,
    // String businessType,
    String contactNumber,
    String companyDescription,
    //String businessLogo,
    String businessStartTime,
    String businessFinishTime,
    String monday,
    String tuesday,
    String wednesday,
    String thursday,
    String friday,
    String saturday,
    String sunday,
    String isPublished) async {
  HttpOverrides.global = new MyHttpOverrides();
  final response = await http.post(
    // Uri.parse('https://172.30.1.10:45455/api/BusinessInfoModels'),
    Uri.parse('https://192.168.1.106:45455/api/BusinessInfoModels'),

    headers: <String, String>{
      'Content-Type': 'application/json; charset=UTF-8',
    },
    body: jsonEncode(<String, String>{
      // 'companyName': companyName,
      // 'rocNumber': rocNumber,
      // 'vendorEmail': vendorEmail,
      // 'businessType': businessType,
      'contactNumber': contactNumber,
      'companyDescription': companyDescription,
      'businessStartTime': businessStartTime,
      'businessFinishTime': businessFinishTime,
      'monday': monday,
      'tuesday': tuesday,
      'wednesday': wednesday,
      'thursday': thursday,
      'friday': friday,
      'saturday': saturday,
      'sunday': sunday,
      'isPublished': isPublished,
    }),
  );

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