예제 #1
0
 public void Unsubscribe(long subscriberId, long userId)
 {
     try
     {
         var subscribe = _subscriberRepository.GetAll()
                         .FirstOrDefault(p => p.SubscriberId == subscriberId && p.UserId == userId);
         if (subscribe == null)
         {
             throw new ServiceException("No this subscribe");
         }
         _subscriberRepository.Delete(subscribe);
     }
     catch (RepositoryException rep)
     {
         throw new ServiceException("", rep);
     }
     catch (Exception ex)
     {
         throw new ServiceException("", ex);
     }
 }
예제 #2
0
 public BaseResponse DeleteSubscriber(string id)
 {
     try
     {
         ISubscriberRepository subscriberRepository = RepositoryClassFactory.GetInstance().GetSubscriberRepository();
         subscriberRepository.Delete(id);
         return(new BaseResponse
         {
             ErrorCode = (int)ErrorCode.None,
             Message = Resources.Resource.msg_delete_success
         });
     }
     catch (Exception ex)
     {
         return(new BaseResponse
         {
             ErrorCode = (int)ErrorCode.Error,
             Message = ex.Message
         });
     }
 }
 public void CanDeleteInNullSubscriberRepository()
 {
     _cut.Delete("", "");
 }