Esempio n. 1
0
        public static BookingDTM changeToDTM(Booking booking)
        {
            BookingDTM bDtm = new BookingDTM();

            bDtm.BusinessId             = booking.BusinessId;
            bDtm.WebpageLink            = booking.WebpageLink;
            bDtm.IsEntityLogoRemoved    = booking.IsEntityLogoRemoved;
            bDtm.IsMemberSelecting      = booking.IsMemberSelecting;
            bDtm.SlotDuration           = booking.SlotDuration;
            bDtm.PageLanguageId         = booking.PageLanguageId;
            bDtm.BannerPicture          = booking.BannerPicture;
            bDtm.SklypeLink             = booking.SklypeLink;
            bDtm.FacebookLink           = booking.FacebookLink;
            bDtm.TwitterLink            = booking.TwitterLink;
            bDtm.InstagramkLink         = booking.InstagramkLink;
            bDtm.YoutubeLink            = booking.YoutubeLink;
            bDtm.PageOverview           = booking.PageOverview;
            bDtm.IsContactsAvailable    = booking.IsContactsAvailable;
            bDtm.IsServicesAvailable    = booking.IsServicesAvailable;
            bDtm.IsPriceAvailable       = booking.IsPriceAvailable;
            bDtm.IsDurationAvailable    = booking.IsDurationAvailable;
            bDtm.IsDescriptionAvailable = booking.IsDescriptionAvailable;

            if (booking.Business != null)
            {
                BusinessDTM businessDtm = new BusinessDTM();
                businessDtm.Id                 = booking.Business.Id;
                businessDtm.Name               = booking.Business.Name;
                businessDtm.Phone              = booking.Business.Phone;
                businessDtm.Logo               = booking.Business.Logo;
                businessDtm.Webpage            = booking.Business.Webpage;
                businessDtm.Address            = booking.Business.Address;
                businessDtm.City               = booking.Business.City;
                businessDtm.State              = booking.Business.State;
                businessDtm.ZipCode            = booking.Business.ZipCode;
                businessDtm.RegistrationNumber = booking.Business.RegistrationNumber;
                if (booking.Business.Country != null)
                {
                    businessDtm.Country = changeToDTM(booking.Business.Country);
                }
                if (booking.Business.Currency != null)
                {
                    businessDtm.Currency = changeToDTM(booking.Business.Currency);
                }
                if (booking.Business.Country != null)
                {
                    businessDtm.Time_zone = changeToDTM(booking.Business.Time_zone);
                }
                //if (booking.Business.Booking != null)
                //    businessDtm.Booking = changeToDTM(booking.Business.Booking);

                bDtm.Business = businessDtm;
            }

            return(bDtm);
        }
Esempio n. 2
0
        // POST: Bookings/bookingDtm
        public async Task <HttpResponseMessage> Post([FromBody] BookingDTM bookingDtm)
        {
            try
            {
                int id = await TheRepo.BookingsDTM.Create(bookingDtm);

                return(Request.CreateResponse(HttpStatusCode.Created, id));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }
Esempio n. 3
0
        public async Task <HttpResponseMessage> Put([FromBody] BookingDTM bookingDtm)
        {
            try
            {
                var originalBooking = TheRepo.BookingsDTM.Get(bookingDtm.BusinessId);

                if (originalBooking == null)
                {
                    return(Request.CreateResponse(HttpStatusCode.NotModified, "Item is not found"));
                }
                else
                {
                    await TheRepo.BookingsDTM.Update(bookingDtm);

                    return(Request.CreateResponse(HttpStatusCode.OK, bookingDtm));
                }
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex));
            }
        }