public async Task <IActionResult> CreateTypesOfTourism(TypesOfTourismDTO typesOfTourismDTO) { var typesOfTourism = _mapper.Map <TypesOfTourismDTO, TypesOfTourism>(typesOfTourismDTO); await _repository.Add(typesOfTourism); return(CreatedAtAction(nameof(GetTypesOfTourism), new { id = typesOfTourism.TypesOfTourismId }, typesOfTourism)); }
public async Task <IActionResult> UpdateTypesOfTourism(int id, TypesOfTourismDTO typesOfTourismDTO) { if (id != typesOfTourismDTO.TypesOfTourismId) { return(BadRequest()); } try { var typesOfTourism = _mapper.Map <TypesOfTourismDTO, TypesOfTourism>(typesOfTourismDTO); await _repository.Update(id, typesOfTourism); } catch (DbUpdateConcurrencyException) { if (!await TypesOfTourismExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }