You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
976 B
Dart
35 lines
976 B
Dart
import 'package:test_sa/models/lookup.dart';
|
|
|
|
class Contact {
|
|
Lookup title;
|
|
Lookup contactPerson;
|
|
String job;
|
|
String email;
|
|
String telephone;
|
|
String landLine;
|
|
|
|
Contact({this.title, this.contactPerson, this.job, this.email, this.telephone, this.landLine});
|
|
|
|
Map<String, String> toMap() {
|
|
return {
|
|
if (title != null) 'title': title.id.toString(),
|
|
if (contactPerson != null) 'contactPerson': contactPerson.id.toString(),
|
|
if (job != null) 'job': job,
|
|
if (email != null) 'email': email,
|
|
if (telephone != null) 'telephone': telephone,
|
|
if (landLine != null) 'landLine': landLine,
|
|
};
|
|
}
|
|
|
|
factory Contact.fromMap(Map<String, dynamic> map) {
|
|
return Contact(
|
|
title: map['title'] as Lookup,
|
|
contactPerson: map['contactPerson'] as Lookup,
|
|
job: map['job'] as String,
|
|
email: map['email'] as String,
|
|
telephone: map['telephone'] as String,
|
|
landLine: map['landLine'] as String,
|
|
);
|
|
}
|
|
}
|