private Contact UpdateContactFromModel(Contact contact, ContactModel model) { contact.Company = model.Company == null ? "" : model.Company; contact.FirstName = model.FirstName == null ? "" : model.FirstName; contact.LastName = model.LastName == null ? "" : model.LastName; contact.Gender = model.Gender == null ? "" : model.Gender; contact.Address1 = model.Address1 == null ? "" : model.Address1; contact.Address2 = model.Address2 == null ? "" : model.Address2; contact.City = model.City == null ? "" : model.City; contact.State = model.State == null ? "" : model.State; contact.PostalCode = model.PostalCode == null ? "" : model.PostalCode; contact.CellPhone = model.CellPhone == null ? "" : model.CellPhone; contact.HomePhone = model.HomePhone == null ? "" : model.HomePhone; contact.WorkPhone = model.WorkPhone == null ? "" : model.WorkPhone; contact.Email = model.Email == null ? "" : model.Email; contact.Birthday = model.Birthday; contact.Notes = model.Notes; return contact; }
private void saveNewContact(ContactModel model) { this.user = userServices.FindUser(this.User.Identity.Name); Contact contact = new Contact(); contact = UpdateContactFromModel(contact, model); contact.User = this.user; contact.Created = DateTime.Now; contact.LastModified = DateTime.Now; contactServices.Save(contact); if (model.isDiver) { Diver diver = new Diver(); diver.Contact = contact; diverServices.Save(diver); } if (model.isInstructor) { Instructor instructor = new Instructor(); instructor.Contact = contact; instructorServices.Save(instructor); } if (model.isAgency) { DiveAgency agency = new DiveAgency(); agency.Contact = contact; diveAgencyServices.Save(agency); } if (model.isManufacturer) { Manufacturer manufacturer = new Manufacturer(); manufacturer.Contact = contact; manufacturerServices.Save(manufacturer); } if (model.isDiveShop) { DiveShop diveShop = new DiveShop(); diveShop.Contact = contact; diveShopServices.Save(diveShop); } }
public ActionResult EditProfile() { user = userServices.FindUser(this.User.Identity.Name); if (user.Contact == null) { Contact contact = new Contact(); contact.User = user; contact.Created = System.DateTime.Now; contactServices.Save(contact); user.Contact = contact; userServices.Save(user); } return (Edit(user.Contact.Id)); }
private string getTags(Contact c) { IList<String> tags = new List<String>(); if (!c.DiveAgencies.IsEmpty) tags.Add("Agency"); if (!c.Divers.IsEmpty) tags.Add("Diver"); if (!c.DiveShops.IsEmpty) tags.Add("DiveShop"); if (!c.Instructors.IsEmpty) tags.Add("Instructor"); if (!c.Manufacturers.IsEmpty) tags.Add("Manufacturer"); return string.Join(", ", tags.ToArray()); }
public virtual bool Equals(Contact obj) { if (obj == null) return false; if (Equals(Address1, obj.Address1) == false) return false; if (Equals(Address2, obj.Address2) == false) return false; if (Equals(Birthday, obj.Birthday) == false) return false; if (Equals(CellPhone, obj.CellPhone) == false) return false; if (Equals(City, obj.City) == false) return false; if (Equals(Company, obj.Company) == false) return false; if (Equals(Id, obj.Id) == false) return false; if (Equals(Created, obj.Created) == false) return false; if (Equals(Email, obj.Email) == false) return false; if (Equals(FirstName, obj.FirstName) == false) return false; if (Equals(Gender, obj.Gender) == false) return false; if (Equals(HomePhone, obj.HomePhone) == false) return false; if (Equals(LastModified, obj.LastModified) == false) return false; if (Equals(LastName, obj.LastName) == false) return false; if (Equals(Notes, obj.Notes) == false) return false; if (Equals(PostalCode, obj.PostalCode) == false) return false; if (Equals(State, obj.State) == false) return false; if (Equals(WorkPhone, obj.WorkPhone) == false) return false; return true; }