コード例 #1
0
        public async Task <int> SaveBuildingHotSpot(HotSpotView dto)
        {
            var info =
                _repository.FirstOrDefault(
                    x => x.HotspotName == dto.HotspotName && x.InfrastructureType == InfrastructureType.HotSpot);

            if (info == null)
            {
                info = dto.MapTo <InfrastructureInfo>();
                info.InfrastructureType = InfrastructureType.HotSpot;
                await _repository.InsertAsync(info);
            }
            else
            {
                dto.MapTo(info);
            }

            return(_repository.SaveChanges());
        }
コード例 #2
0
 public async Task <int> Post(HotSpotView dto)
 {
     return(await _service.SaveBuildingHotSpot(dto));
 }