public async Task <IActionResult> CreateHallAsync( [FromBody, SwaggerParameter(Description = "Hall to create", Required = true)] HallToCreateDto hallToCreate, [FromHeader(Name = "Accept"), SwaggerParameter(Description = "media type to request between json or json+hateoas")] string mediaType) { var hallToAdd = Mapper.Map <Hall>(hallToCreate); _hallRepository.AddHall(hallToAdd); if (!await _hallRepository.SaveChangesAsync()) { _logger.LogError("Saving changes to database while creating a hall failed"); } if (mediaType == "application/vnd.biob.json+hateoas") { var links = CreateLinksForHall(hallToAdd.Id); var linkedHall = hallToAdd.ShapeData(null) as IDictionary <string, object>; linkedHall.Add("links", links); return(CreatedAtRoute("GetHall", new { hallId = hallToAdd.Id }, linkedHall)); } return(CreatedAtRoute("GetHall", new { hallId = hallToAdd.Id }, hallToAdd)); }