public bool AddOrUpdate(BookingDestination bookingDestination) { bool isSaved = true; using (WTCCeresEntities db = new WTCCeresEntities()) { try { if (bookingDestination.BookingDestinationId == 0) { db.BookingDestination.Add(bookingDestination); } else { db.BookingDestination.AddOrUpdate(bookingDestination); } db.SaveChanges(); } catch (Exception ex) { string message = ex.Message; isSaved = false; } } return(isSaved); }
public bool Delete(BookingDestination bookingDestination) { bool isSaved = true; using (WTCCeresEntities db = new WTCCeresEntities()) { try { db.BookingDestination.Remove(bookingDestination); db.SaveChanges(); } catch (Exception ex) { string message = ex.Message; isSaved = false; } } return(isSaved); }
private void doneAddressButton_Click(object sender, EventArgs e) { var destService = new BookingDestinationService(); BookingDestination bkDest; if (isNewDest) { bkDest = new BookingDestination(); bkDest.BookingDestinationId = default; } else { bkDest = BookingDestinationService.GetById(selDestId); } bkDest.CountryCode = Strings.Trim(tbCountryCode.Text); bkDest.OriginalRegionName = Strings.Trim(tbRegionName.Text); bkDest.RegionName = Strings.Trim(tbRegionName.Text); bkDest.City = Strings.Trim(tbCityName.Text); bkDest.AddressDestination = Strings.Trim(addressTextBox.Text); bkDest.Coordinates = Strings.Trim(tbCoordinates.Text); destService.AddOrUpdate(bkDest); Close(); }
public bool Delete(BookingDestination bookingDestination) { return(repository.Delete(bookingDestination)); }
public bool AddOrUpdate(BookingDestination bookingDestination) { return(repository.AddOrUpdate(bookingDestination)); }