public async Task <bool> AddSubscription(SubcsriptionModel model) { var subscribtion = new Subscription() { Email = model.Email, Category = model.Category, SubscribeAll = model.SubscribeAll, Created = DateTime.UtcNow }; bool result = await _subscriptionRepository.InsertSubscriptionAsync(subscribtion); return(result); }
public async Task <ActionResult> AddSubsctiption(SubcsriptionModel model) { if (string.IsNullOrWhiteSpace(model.Email)) { return(BadRequest("You shuold provide valid email")); } bool result = await _subscriptionService.AddSubscription(model); if (result) { return(Ok("You subscribed to news!")); } return(BadRequest("Something went wrong!")); }