Beispiel #1
0
 public Chat GetChat(Guid id)
 {
     try
     {
         return(_chatsRepository.GetChat(id));
     }
     catch (SqlException exception)
     {
         var response = new HttpResponseMessage(HttpStatusCode.NotFound)
         {
             Content = new StringContent(exception.Message)
         };
         throw new HttpResponseException(response);
     }
     catch (Exception exception)
     {
         var response = new HttpResponseMessage(HttpStatusCode.BadRequest)
         {
             Content = new StringContent(exception.Message)
         };
         throw new HttpResponseException(response);
     }
 }
Beispiel #2
0
 public Chat Get(Guid userId, Guid chatId)
 {
     _logger.Info($"{DateTime.Now.ToShortDateString()} Chat with id: {chatId} has been queried");
     return(_chatsRepository.GetChat(chatId, userId));
 }