// POST: api/Bookings
        public bool Post([FromBody] Booking booking)
        {
            bool settingsOk = bookingSettingsManager.Post(Extractables.ExtractBookingSettings(booking));

            bool bookedOk = false;

            if (settingsOk)
            {
                bookedOk = true;
                foreach (int eventId in booking.BookedEventsId)
                {
                    bookedOk = bookedEventsManager.Post(Extractables.ExtractBookedEvents(booking.UserId, eventId));
                }
            }

            return(settingsOk && bookedOk);
        }
        // POST: api/Events
        public bool Post([FromBody] Event sikonEvent)
        {
            _initialIds = GetAllIds();
            bool eventOk = eventManager.Post(Extractables.ExtractEvent(sikonEvent));

            bool speakersInEventOk = false;

            if (eventOk)
            {
                sikonEvent.EventID = RetrieveId();
                speakersInEventOk  = true;
                foreach (Speaker speaker in sikonEvent.SpeakersInEvent)
                {
                    speakersInEventOk = speakersInEventManager.Post(Extractables.ExtractSpeakersInEvent(sikonEvent.EventID, speaker.Id));
                }
            }

            return(eventOk && speakersInEventOk);
        }
Esempio n. 3
0
        // POST: api/Messages
        public bool Post([FromBody] Message message)
        {
            //string content = message.ToString();
            //string[] splitContent = content.Split(new [] {','},2);
            //string idString = splitContent[0].Remove(0, splitContent[0].IndexOf(":")+2);
            //string messageString = splitContent[1].Remove(0, splitContent[1].IndexOf(":")+2);
            //messageString = messageString.TrimEnd(new char[]{'}', '\r', '\n'}).Trim('"');
            //MessagesManager.Post(Extractables.ExtractMessage(Convert.ToInt32(idString), messageString));

            return(messageManager.Post(Extractables.ExtractMessage(message)));
        }
        // POST: api/Users
        public bool Post([FromBody] User user)
        {
            user.Id = -1;
            if (CheckNoDuplicate(user))
            {
                //CleanUserStrings(user);
                return(manager.Post(Extractables.ExtractUser(user)));
            }

            return(false);
        }
Esempio n. 5
0
 private void Clean()
 {
     try
     {
         manager.Delete(PrimaryKeys(0));
         if (actualData.Name != string.Empty || actualData.Address != string.Empty) //Only put data back in if it is worthwhile data.
         {
             manager.Post(Extractables.ExtractHotel(actualData));
         }
     }
     catch (Exception e)
     {
     }
 }
        // POST: api/Admins
        public bool Post([FromBody] Admin admin)
        {
            admin.Id = -1;
            bool userOk = false;

            if (CheckNoDuplicate(admin))
            {
                userOk = userManager.Post(Extractables.ExtractUser(admin));
            }

            bool adminOk = false;

            if (userOk)
            {
                admin.Id = RetrieveId(admin);
                adminOk  = adminManager.Post(Extractables.ExtractAdmin(admin));
            }

            return(userOk && adminOk);
        }
        // POST: api/Speakers
        public bool Post([FromBody] Speaker speaker)
        {
            speaker.Id = -1;
            bool userOk = false;

            if (CheckNoDuplicate(speaker))
            {
                userOk = userManager.Post(Extractables.ExtractUser(speaker));
            }

            bool speakerOk = false;

            if (userOk)
            {
                speaker.Id = RetrieveId(speaker);
                speakerOk  = speakerManager.Post(Extractables.ExtractSpeaker(speaker));
            }

            return(userOk && speakerOk);
        }
Esempio n. 8
0
 // POST: api/BookingSettings
 public bool Post([FromBody] Booking booking)
 {
     return(bookingSettingsManager.Post(Extractables.ExtractBookingSettings(booking)));
 }
 // POST: api/Rooms
 public bool Post([FromBody] Room room)
 {
     return(manager.Post(Extractables.ExtractRoom(room)));
 }
 // POST: api/Hotels
 public bool Post([FromBody] Hotel hotel)
 {
     return(manager.Post(Extractables.ExtractHotel(hotel)));
 }
Esempio n. 11
0
 // POST: api/Guests
 public bool Post([FromBody] Guest guest)
 {
     return(manager.Post(Extractables.ExtractGuest(guest)));
 }
 // POST: api/Bookings
 public bool Post([FromBody] Booking booking) //Beware of cultural differences with dates
 {
     return(manager.Post(Extractables.ExtractBooking(booking)));
 }