public static DentistDTO UpdateDentistViewModelToDTO(UpdateDentistViewModel updateDentist)
 {
     return(new DentistDTO
     {
         Id = updateDentist.Id,
         FirstName = updateDentist.FirstName,
         LastName = updateDentist.LastName,
         PhoneNumber = updateDentist.PhoneNumber
     });
 }
Exemplo n.º 2
0
        public IActionResult UpdateDentist(string id, [FromBody] UpdateDentistViewModel updateDentistViewModel)
        {
            if (id != updateDentistViewModel.Id)
            {
                return(BadRequest());
            }

            if (!_service.Exist(id))
            {
                return(NotFound());
            }

            var dentalDTO = DentistMapper.UpdateDentistViewModelToDTO(updateDentistViewModel);

            _service.Update(dentalDTO);

            return(NoContent());
        }