public async Task <IActionResult> PostAsync(Transfer_Specialty specialty) { _logger.LogInformation($"Adding new specialty."); Inner_Specialty transformedSpecialty = new Inner_Specialty { SpecialtyId = 0, Specialty = specialty.Specialty }; await _specialtyRepository.AddSpecialtyAsync(transformedSpecialty); return(CreatedAtAction(nameof(GetByIdAsync), new { id = specialty.SpecialtyId }, specialty)); }
public async Task <IActionResult> PutAsync(int id, [FromBody] Transfer_Specialty specialty) { _logger.LogInformation($"Editing specialty with id {id}."); var entity = await _specialtyRepository.GetSpecialtyByIdAsync(id); if (entity is Inner_Specialty) { entity.Specialty = specialty.Specialty; return(NoContent()); } _logger.LogInformation($"No specialties found with id {id}."); return(NotFound()); }