public void AddSubscriptionToUser(AddSubcriptionToUser addSubcriptionToUser) { try { CommandService.AddSubscriptionToUser(addSubcriptionToUser); } catch (Exception ex) { Logger.LogError(ex); throw new FaultException(ex.Message); } }
public async Task <IHttpActionResult> AddSubscriptionToUser([FromUri] Guid id, [FromBody] AddSubcriptionToUser request) { try { await CommandService.AddSubscriptionToUser(id, request.SubscriptionId); return(Ok()); } catch (Exception ex) { Logger.LogError(ex); // Can be fine tuned to throw a general exception instead of sending the server exception return(InternalServerError(ex)); } }