Exemplo n.º 1
0
        public RespondentInfo Put(int id, [FromBody] UpdateRespondentRequest value)
        {
            var existingRespondent = _respondentsRepository.Get(id);

            existingRespondent.Name           = value.Name ?? existingRespondent.Name;
            existingRespondent.Email          = value.Email ?? existingRespondent.Email;
            existingRespondent.HashedPassword = _hashingService.HashString(value.NewPassword) ?? existingRespondent.HashedPassword;

            _respondentsRepository.Update(existingRespondent);

            return(RespondentInfo.FromEntity(existingRespondent));
        }
Exemplo n.º 2
0
 public RespondentInfo Post([FromBody] NewRespondentRequest value)
 => RespondentInfo.FromEntity(_respondentsRepository.Add(value.ToEntity(_hashingService)));
Exemplo n.º 3
0
 public RespondentInfo Get(int id) => RespondentInfo.FromEntity(_respondentsRepository.Get(id));