Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
 public bool Delete(BookingDestination bookingDestination)
 {
     return(repository.Delete(bookingDestination));
 }
Esempio n. 5
0
 public bool AddOrUpdate(BookingDestination bookingDestination)
 {
     return(repository.AddOrUpdate(bookingDestination));
 }