public SubscriberBl Capture() { var newSubscriber = new SubscriberBl { Name = _ioHelper.GetStringFromUser("Enter the name of the subscriber: "), Surname = _ioHelper.GetStringFromUser("Enter the surname of the subscriber: "), DateOfBirth = _ioHelper.GetDateOfBirthFromUser("Enter the birth date of the subscriber in the following format: 'dd-mm-yyyy': "), Email = _subscriberService.CheckEmail(_ioHelper.GetStringFromUser("Enter the email (e.g. [email protected]): ")), BillingCycle = _subscriberService.ChooseLeastCountedBillingCycle() }; return(newSubscriber); }
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)); } }