Пример #1
0
        private async Task CreatePlaqueChangeAsync(PlaqueChangeCreateOrUpdateInput input)
        {
            if (input.PlaqueId.HasValue)
            {
                var plaqueInfo = _plaqueInfoRepository.Get(input.PlaqueId.Value);
                plaqueInfo.StateId = input.NewStateId;
                await _plaqueInfoRepository.UpdateAsync(plaqueInfo);
            }
            else
            {
                var plaqueInfo = new PlaqueInfo {
                    Code      = Convert.ToInt64(input.PlaqueCode),
                    OfficerId = input.OfficerId,
                    StateId   = input.NewStateId,
                    Latitude  = "",
                    Longitude = ""
                };
                await _plaqueInfoRepository.InsertAsync(plaqueInfo);

                await CurrentUnitOfWork.SaveChangesAsync();

                input.PlaqueId = plaqueInfo.Id;
            }
            var plaqueChange = ObjectMapper.Map <PlaqueChange>(input);
            await _plaqueChangeRepository.InsertAsync(plaqueChange);
        }
Пример #2
0
        private async Task CreatePlaqueToHerdAsync(PlaqueToHerdCreateOrUpdateInput input)
        {
            var plaqueToHerd = ObjectMapper.Map <PlaqueToHerd>(input);
            await _plaqueToHerdRepository.InsertAsync(plaqueToHerd);

            var plaqueInfo = new PlaqueInfo
            {
                Code      = Convert.ToInt64(plaqueToHerd.NationalCode),
                Latitude  = plaqueToHerd.Latitude,
                Longitude = plaqueToHerd.Longitude,
                OfficerId = plaqueToHerd.OfficerId,
                StateId   = 5
            };
            await _plaqueInfoRepository.InsertAsync(plaqueInfo);
        }