public async Task <HttpResponseMessage> AddSubscriberAsync([FromBody] SubscriberBl subscriber)
        {
            try
            {
                subscriber.BillingCycle = await Task.Run(() => _subscriberService.ChooseLeastCountedBillingCycle());

                var subscriberId = await _subscriberService.AddSubscriberAsync(subscriber);

                return(Request.CreateResponse(HttpStatusCode.OK, subscriberId));
            }
            catch (Exception e)
            {
                var message = $"failed adding new subscriber. {e.Message}";
                return(Request.CreateResponse(HttpStatusCode.NotFound, message));
            }
        }
예제 #2
0
 public async Task AddSubscriberAsync(SubscriberBl subscriberBl)
 {
     await _subscriberService.AddSubscriberAsync(subscriberBl);
 }