Exemple #1
0
        public async Task CreateFloor(CreateFloorDTO input)
        {
            var floor = _mapper.Map <Floor>(input);

            floor.Building = await _buildingRepository.GetById(input.BuildingId); //firstly you must get building with building ID

            await _repository.Create(floor);                                      // and then you can push on create method
        }
Exemple #2
0
        public async Task CreateBeacon(CreateBeaconDTO input)
        {
            var beacon = _mapper.Map <Beacon>(input);

            beacon.Artifact = await _artifactRepository.GetById(input.ArtifactId);

            await _beaconRepository.Create(beacon);
        }
Exemple #3
0
        public async Task CreateBeacon(CreateBeaconDTO input)
        {
            var beacon = _mapper.Map <Beacon>(input);

            beacon.Location = await _locationRepository.GetById(input.LocationId);

            await _beaconRepository.Create(beacon);
        }
Exemple #4
0
        public async Task <ReadContentDTO> GetContent(EntityDTO input)
        {
            var content = await _repository.GetById(input.Id);

            var result = _mapper.Map <ReadContentDTO>(content);

            return(result);
        }
Exemple #5
0
        public async Task CreateLocation(CreateLocationDTO input)
        {
            var location = _mapper.Map <Location>(input);

            location.Project = await _projectRepository.GetById(input.ProjectId);

            location.User = await _userRepository.GetById(input.UserId);

            await _repository.Create(location);
        }
Exemple #6
0
        public async Task CreateRoom(CreateRoomDTO input)
        {
            var room = _mapper.Map <Room>(input);

            if (input.FloorId != Guid.Empty)
            {
                room.Floor = await _floorRepository.GetById(input.FloorId);
            }

            if (input.BeaconId != Guid.Empty)
            {
                room.Beacon = await _beaconRepository.GetById(input.BeaconId);
            }
            await _roomRepository.Create(room);
        }
Exemple #7
0
        public async Task <ReadRelationDTO> GetRelation(EntityDTO input)
        {
            Relation relation = await _relationRepository.GetById(input.Id);

            ReadRelationDTO result = new ReadRelationDTO()
            {
                Id          = relation.Id,
                CreatedTime = relation.CreatedTime,
                ArtifacName = relation.Artifact.Name,
                BeaconName  = relation.Beacon.Name,
                ContentName = relation.Content.Name
            };

            result.Proximity = GetEnumString(relation.Proximity);
            return(result);
        }
Exemple #8
0
        public async Task UpdateRelation(UpdateRelationDTO input)
        {
            Relation result = await _relationRepository.GetById(input.Id);

            if (input.ArtifactId != Guid.Empty)
            {
                result.Artifact = await _artifactRepository.GetById(input.ArtifactId);

                result.Location = result.Artifact.Location;
            }
            if (input.BeaconId != Guid.Empty)
            {
                result.Beacon = await _beaconRepository.GetById(input.BeaconId);
            }
            if (input.ContentId != Guid.Empty)
            {
                result.Content = await _contentRepository.GetById(input.ContentId);
            }
            if (!String.IsNullOrEmpty(input.Proximity))
            {
                result.Proximity = (Proximity)Enum.Parse(typeof(Proximity), input.Proximity, true);
            }

            var artifact = await _artifactRepository.GetAll()
                           .Include(x => x.Location)
                           .Where(x => x.Id == input.Id)
                           .FirstOrDefaultAsync();

            result.Location = artifact.Location;

            await _relationRepository.Update(input.Id, result);
        }
Exemple #9
0
        public async Task <ReadBeaconDTO> GetBeacon(EntityDTO input)
        {
            var beacon = await _beaconRepository.GetById(input.Id);

            var result = _mapper.Map <ReadBeaconDTO>(beacon);

            return(result);
        }
Exemple #10
0
        public async Task CreateBuilding(CreateBuildingDTO input)
        {
            var building = _mapper.Map <Building>(input);

            building.Location = await _locationRepository.GetById(input.LocationId);

            await _buildingRepository.Create(building);
        }
Exemple #11
0
        public async Task CreateBeaconActivity(CreateBeaconActivityDTO input)
        {
            var beaconActivity = _mapper.Map <BeaconActivity>(input);

            beaconActivity.Beacon = await _beaconRepository.GetById(input.BeaconId);

            await _beaconActivityRepository.Create(beaconActivity);
        }
Exemple #12
0
        public async Task CrateContent(CreateContentDTO input)
        {
            var content = _mapper.Map <Content>(input);

            content.Location = await _locationRepository.GetById(input.LocationId);

            await _repository.Create(content);
        }
Exemple #13
0
        public async Task <ReadRoomDTO> GetRoom(EntityDTO input)
        {
            var room = await _roomRepository.GetById(input.Id);

            var result = _mapper.Map <ReadRoomDTO>(room);

            result.FloorName = room.Floor.Name;
            return(result);
        }
Exemple #14
0
        /// <inheritdoc />
        public async Task <TEntity> GetById(Guid id)
        {
            var e = await Repository.GetById(id);

            if (e == null)
            {
                throw new MccNotFoundException($"{typeof(TEntity)} with Id {id} was not found.");
            }
            return(e);
        }
Exemple #15
0
        public async Task UpdateArtifact(UpdateArtifactDTO input)
        {
            var artifact = await _artifactRepository.GetById(input.Id);

            artifact.Name = input.Name;
            if (input.RoomId != Guid.Empty)
            {
                artifact.Room = await _roomRepository.GetById(input.RoomId);
            }
            artifact.CreatedTime = DateTime.Now;
            if (!String.IsNullOrEmpty(input.MainImageURL))
            {
                artifact.MainImageURL = input.MainImageURL;
            }

            await _artifactRepository.Update(artifact.Id, artifact);
        }
Exemple #16
0
        // EntityDTO is a Project Id.
        public async Task <ReadProjectDTO> GetProject(EntityDTO input)
        {
            var project = await _repository.GetById(input.Id);

            return(_mapper.Map <ReadProjectDTO>(project));
        }
Exemple #17
0
        public async Task <ReadBeaconActivityDTO> GetBeaconActivity(EntityDTO input)
        {
            var beaconActivity = await _beaconActivityRepository.GetById(input.Id);

            return(_mapper.Map <ReadBeaconActivityDTO>(beaconActivity));
        }