private void AddEquipment(EventRoomEquipmentDto equipment, int eventId, EventRoomDto room, string token) { var equipmentReservation = new MpEquipmentReservationDto(); equipmentReservation.Cancelled = false; equipmentReservation.EquipmentId = equipment.EquipmentId; equipmentReservation.EventId = eventId; equipmentReservation.QuantityRequested = equipment.QuantityRequested; equipmentReservation.RoomId = room.RoomId; equipmentReservation.Notes = room.Notes; _equipmentService.CreateEquipmentReservation(equipmentReservation); }
private List <EventRoomDto> PopulateRoomReservations(int eventId, bool includeEquipment, bool includeParticipants) { var rooms = _roomService.GetRoomReservations(eventId); var roomDto = new List <EventRoomDto>(); foreach (var room in rooms) { var r = new EventRoomDto(); r.Cancelled = room.Cancelled; r.Hidden = room.Hidden; r.LayoutId = room.RoomLayoutId; r.Notes = room.Notes; r.RoomId = room.RoomId; r.RoomReservationId = room.EventRoomId; r.Capacity = room.Capacity; r.CheckinAllowed = room.CheckinAllowed; r.Name = room.Name; r.Label = room.Label; r.Volunteers = room.Volunteers; if (includeEquipment) { var equipmentDto = new List <EventRoomEquipmentDto>(); var equipment = _equipmentService.GetEquipmentReservations(eventId, room.RoomId); foreach (var equipmentReservation in equipment) { var eq = new EventRoomEquipmentDto(); eq.Cancelled = equipmentReservation.Cancelled; eq.EquipmentId = equipmentReservation.EquipmentId; eq.QuantityRequested = equipmentReservation.QuantityRequested; eq.EquipmentReservationId = equipmentReservation.EventEquipmentId; eq.Notes = equipmentReservation.Notes; equipmentDto.Add(eq); } r.Equipment = equipmentDto; } if (includeParticipants) { var p = _eventParticipantService.GetEventParticipants(eventId, room.RoomId); r.ParticipantsAssigned = p == null ? 0 : p.Count; r.ParticipantsCheckedIn = p == null ? 0 : p.Where(participant => participant.ParticipantStatus == 3).ToList().Count; r.ParticipantsSignedIn = p == null ? 0 : p.Where(participant => participant.ParticipantStatus == 4).ToList().Count; } roomDto.Add(r); } return(roomDto); }