Exemplo n.º 1
0
        public async Task UpdateCommander(UpdateCommanderDto commanderDto)
        {
            var commander = await _commanderRepository.GetByPesel(commanderDto.Pesel);

            commander = CommanderMapper.UpdateCommanderMap(commanderDto, commander);
            await _commanderRepository.UpdateCommander(commander);
        }
Exemplo n.º 2
0
 public static Commander UpdateCommanderMap(UpdateCommanderDto commanderDto, Commander commander)
 {
     commander.FirstName    = commanderDto.FirstName;
     commander.LastName     = commanderDto.LastName;
     commander.Email        = commanderDto.Email;
     commander.Pesel        = commanderDto.Pesel;
     commander.PhoneNumber  = commanderDto.PhoneNumber;
     commander.Street       = commanderDto.Address.Substring(0, commanderDto.Address.IndexOf(' '));
     commanderDto.Address   = commanderDto.Address.Remove(0, commanderDto.Address.IndexOf(' ') + 1);
     commander.HouseNumber  = commanderDto.Address.Substring(0, commanderDto.Address.IndexOf(' '));
     commanderDto.Address   = commanderDto.Address.Remove(0, commanderDto.Address.IndexOf(' ') + 1);
     commander.PostCode     = commanderDto.Address.Substring(0, commanderDto.Address.IndexOf(' '));
     commanderDto.Address   = commanderDto.Address.Remove(0, commanderDto.Address.IndexOf(' ') + 1);
     commander.City         = commanderDto.Address.Substring(0, commanderDto.Address.Length);
     commander.MilitaryRank = commanderDto.MilitaryRank;
     return(commander);
 }
Exemplo n.º 3
0
        public async Task <ActionResult> UpdateCommander([FromBody] UpdateCommanderDto commanderDto)
        {
            await _commanderService.UpdateCommander(commanderDto);

            return(Ok());
        }