public async Task <IActionResult> Post([FromBody] Models.Restriction restriction) { if (restriction == null) { //_logger.LogInformation($"User is empty when accessing to UserController/Post(UserDto restriction)."); return(BadRequest()); } if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var restrictionEntity = _mapper.Map <Entities.Restriction>(restriction); await _restrictionRepository.AddAsync(restrictionEntity); if (!await _restrictionRepository.SaveAsync()) { // _logger.LogError($"Add User is not valid. Error in SaveAsync(). When accessing to UserController/Post"); return(StatusCode(500, "A problem happend while handling your request.")); } //TODO: Implement Realistic Implementation return(Created("", null)); }