コード例 #1
0
        public async Task UpdateContent(UpdateContentDTO input)
        {
            var c = await _repository.GetById(input.Id);

            c.IsHomePage = input.IsHomePage;
            c.IsCampaign = input.IsCampaign;
            if (!string.IsNullOrEmpty(input.MainImageURL))
            {
                c.MainImageURL = input.MainImageURL;
            }
            if (!string.IsNullOrEmpty(input.SlideImageURL))
            {
                c.SlideImageURL = input.SlideImageURL;
            }
            if (!string.IsNullOrEmpty(input.VideoURL))
            {
                c.VideoURL = input.VideoURL;
            }
            if (!string.IsNullOrEmpty(input.AudioURL))
            {
                c.AudioURL = input.AudioURL;
            }
            c.Name        = input.Name;
            c.Title       = input.Title;
            c.Description = input.Description;
            c.Text        = input.Text;
            c.CreatedTime = input.CreatedTime;
            await _repository.Update(c.Id, c);
        }
コード例 #2
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);
        }
コード例 #3
0
        public async Task UpdateLocation(UpdateLocationDTO input)
        {
            var location = _mapper.Map <Location>(input);

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

            await _repository.Update(location.Id, location);
        }
コード例 #4
0
        public async Task UpdateRoom(UpdateRoomDTO input)
        {
            var room = _mapper.Map <Room>(input);

            room.Floor = await _floorRepository.GetById(input.FloorId);

            await _roomRepository.Update(input.Id, room);
        }
コード例 #5
0
        public async Task UpdateBeacon(UpdateBeaconDTO input)
        {
            var beacon = _mapper.Map <Beacon>(input);

            if (Guid.Empty != input.ArtifactId)
            {
                beacon.Artifact = await _artifactRepository.GetById(input.ArtifactId);
            }
            await _beaconRepository.Update(input.Id, beacon);
        }
コード例 #6
0
        public async Task UpdateFloor(UpdateFloorDTO input)
        {
            var floor = _mapper.Map <Floor>(input);

            if (Guid.Empty != input.BuildingId)
            {
                floor.Building = await _buildingRepository.GetById(input.BuildingId);
            }
            await _repository.Update(floor.Id, floor);
        }
コード例 #7
0
        public async Task UpdateBeacon(UpdateBeaconDTO input)
        {
            var beacon = _mapper.Map <Beacon>(input);

            if (Guid.Empty != input.LocationId)
            {
                beacon.Location = await _locationRepository.GetById(input.LocationId);
            }
            await _beaconRepository.Update(input.Id, beacon);
        }
コード例 #8
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);
        }
コード例 #9
0
        /// <inheritdoc />
        public Task <TEntity> Update(TEntity entityUpdate)
        {
            CheckEntityIsValid(entityUpdate);

            return(Repository.Update(entityUpdate));
        }
コード例 #10
0
 public async Task UpdateProject(UpdateProjectDTO input)
 {
     var project = _mapper.Map <Project>(input);
     await _repository.Update(input.Id, project);
 }
コード例 #11
0
        //public async Task<List<ReadBuildingDTO>> GetBuildingsAtLocation(EntityDTO input)
        //{
        //    var buildings = await _buildingRepository
        //        .GetAll()
        //        .Include(x => x.Location)
        //        .Where(x => x.Location.Id == input.Id)
        //        .ToListAsync();


        //    List<ReadBuildingDTO> result = new List<ReadBuildingDTO>();

        //    foreach (var item in buildings)
        //    {
        //        ReadBuildingDTO dto = new ReadBuildingDTO();

        //        dto = _mapper.Map<ReadBuildingDTO>(item);
        //        dto.LocationName = item.Location.Name;

        //        result.Add(dto);
        //    }
        //    return result;
        //}

        public async Task UpdateBuilding(UpdateBuildingDTO input)
        {
            var building = _mapper.Map <Building>(input);
            await _buildingRepository.Update(input.Id, building);
        }
コード例 #12
0
 public async Task UpdateProfile(UpdateUserDTO input)
 {
     var user = _mapper.Map <User>(input);
     await _userRepository.Update(input.Id, user);
 }