Пример #1
0
        public void ManagerPut_PutCompletes()
        {
            Setup();

            Hotel editedHotel = new Hotel(0, "OtherHotel", "OtherStreet");

            try
            {
                manager.Put(Extractables.ExtractHotel(editedHotel), PrimaryKeys(0));
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
            }

            Clean();
        }
 // PUT: api/Users/5
 public bool Put(int id, [FromBody] User user)
 {
     user.Id = id;
     if (!CheckNoDuplicate(user))
     {
         return(false);
     }
     //CleanUserStrings(user);
     return(manager.Put(Extractables.ExtractUser(user), PrimaryKeys(id)));
 }
        // PUT: api/Events/5
        public bool Put(int id, [FromBody] Event sikonEvent)
        {
            bool eventOk = eventManager.Put(Extractables.ExtractEvent(sikonEvent), PrimaryKeys(id));

            bool speakersInEventOk = false;

            if (eventOk)
            {
                speakersInEventManager.Delete(PrimaryKeys(id));

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

            return(eventOk && speakersInEventOk);
        }
        // PUT: api/Admins/5
        public bool Put(int id, [FromBody] Admin admin)
        {
            admin.Id = id;
            if (!CheckNoDuplicate(admin))
            {
                return(false);
            }

            bool adminOk = adminManager.Put(Extractables.ExtractAdmin(admin), PrimaryKeys(id));

            bool userOk = false;

            if (adminOk)
            {
                //UsersController.CleanUserStrings(user);
                userOk = userManager.Put(Extractables.ExtractUser(admin), PrimaryKeys(id));
            }

            return(adminOk && userOk);
        }
        // PUT: api/Speakers/5
        public bool Put(int id, [FromBody] Speaker speaker)
        {
            speaker.Id = id;
            if (!CheckNoDuplicate(speaker))
            {
                return(false);
            }

            bool speakerOk = speakerManager.Put(Extractables.ExtractSpeaker(speaker), PrimaryKeys(id));

            bool userOk = false;

            if (speakerOk)
            {
                userOk = userManager.Put(
                    Extractables.ExtractUser(speaker), PrimaryKeys(id));
            }

            return(speakerOk && userOk);
        }
Пример #6
0
 // PUT: api/BookingSettings/5
 public bool Put(int id, [FromBody] Booking booking)
 {
     return(bookingSettingsManager.Put(Extractables.ExtractBookingSettings(booking),
                                       BookingsController.PrimaryKeys(id)));
 }
 public bool Put(int roomNo, int hotelNo, [FromBody] Room room)
 {
     return(manager.Put(Extractables.ExtractRoom(room), PrimaryKeys(roomNo, hotelNo)));
 }
 // PUT: api/Hotels/5
 public bool Put(int id, [FromBody] Hotel hotel)
 {
     return(manager.Put(Extractables.ExtractHotel(hotel), PrimaryKeys(id)));
 }
 // PUT: api/Rooms/5
 public bool Put(int id, [FromBody] Room room)
 {
     return(roomManager.Put(Extractables.ExtractRoom(room), PrimaryKeys(id)));
 }
Пример #10
0
 // PUT: api/Guests/5
 public bool Put(int id, [FromBody] Guest guest)
 {
     return(manager.Put(Extractables.ExtractGuest(guest), PrimaryKeys(id)));
 }
 // PUT: api/Bookings/5
 public bool Put(int id, [FromBody] Booking booking)
 {
     return(manager.Put(Extractables.ExtractBooking(booking), PrimaryKeys(id)));
 }