// POST Contacts public int Post(Contact Contact) { return DataSource<Contact> .Command("AddContact") .Parameter(new SqlParameter("Name", Contact.Name)) .ExecuteAndReturnId(); }
// PUT Contacts/7 public void Put(Contact Contact) { DataSource<Contact> .Command("UpdateContact") .Parameter(new SqlParameter("Id", Contact.Id)) .Parameter(new SqlParameter("Name", Contact.Name)) .Execute(); }
private Contact DbToModel(IDataReader reader) { Contact obj = new Contact(); obj.Id = Utility.GetInt(reader, "Id"); obj.SourceId = Utility.GetInt(reader, "SourceId"); obj.SourceType = Utility.GetString(reader, "SourceType"); obj.ContactTypeId = Utility.GetInt(reader, "ContactTypeId"); obj.ContactType = Utility.GetString(reader, "ContactType"); obj.Name = Utility.GetString(reader, "Name"); obj.FirstName = Utility.GetString(reader,"FirstName"); obj.LastName = Utility.GetString(reader, "LastName"); obj.Email = Utility.GetString(reader, "Email"); obj.Email2 = Utility.GetString(reader, "Email2"); obj.Phone = Utility.GetString(reader, "Phone"); obj.Phone2 = Utility.GetString(reader, "Phone2"); obj.Street = Utility.GetString(reader, "Street"); obj.Street2 = Utility.GetString(reader, "Street2"); obj.City = Utility.GetString(reader, "City"); obj.StateId = Utility.GetInt(reader, "StateId"); obj.Zip = Utility.GetString(reader, "Zip"); return obj; }
//public ICollection<Contact> Members { get; set; } //public ICollection<Auction> Auctions { get; set; } public Organization() { BillingContact = new Contact(); //Members = new List<Contact>(); //Auctions = new List<Auction>(); }