public virtual async Task <ActionResult <ResponseDto> > Create([FromBody] ResponseRequest request) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var dto = await _responseService.CreateEntityAsync(request); if (dto == null) { return(StatusCode(500)); } var userFeedback = request.Feedback.User; if (userFeedback != null) { var notificationRequest = new NotificationRequest { Text = request.Text, CreatedAt = request.CreatedAt, UserId = userFeedback.Id, OrganizationId = userFeedback.LastPickedOrganizationId, Type = NotificationType.Info }; await _notificationService.CreateEntityAsync(notificationRequest); } else { await _emailProvider.SendMessageOneToOne("*****@*****.**", "Thanks for feedback", request.Feedback.Email, request.Text, ""); } return(CreatedAtAction("GetById", new { id = dto.Id }, dto)); }