示例#1
0
 public int CountMessages(Guid chatId, Guid profileId)
 {
     try
     {
         var profile = _profilesRepository.GetProfile(profileId);
         if (!profile.IsOnline || (DateTime.Now.TimeOfDay - profile.LastQueryDate.TimeOfDay).Minutes >= 1)
         {
             _profilesRepository.LoginProfile(profileId);
         }
         return(_messagesRepository.CountMessages(chatId));
     }
     catch (SqlException exception)
     {
         var response = new HttpResponseMessage(HttpStatusCode.NotFound)
         {
             Content = new StringContent(exception.Message)
         };
         throw new HttpResponseException(response);
     }
 }