Example #1
0
 public int SaveAddress(Address address)
 {
     try
     {
         _ncEntities.Addresses.Add(address);
         _ncEntities.SaveChanges();
         return address.Id;
     }
     catch (Exception)
     {
         return 0;
     }
 }
 private int SaveAddress(CreatePost post)
 {
     //Create address object and save it to table and assign its id to the postmodel's locationid
     Address address = new Address
     {
         CityId = Int32.Parse(post.City),
         StateId = Int32.Parse(post.State),
         CountryId = Int32.Parse(post.Country),
         ZipCode = Int32.Parse(post.ZipCode ?? NcConstants.DefaultZipCodeId)
     };
     return _addressRepository.SaveAddress(address);
 }