public UserMessage SetCardActivation(SetCardActivationCommand command) { EnsureIsValid(command); try { var userCard = _deps.UserCards.SurelyFind(command.CardId); var message = command.IsActive ? UserMessage.Resource(() => Messages.CardActivated) : UserMessage.Resource(() => Messages.CardDeactivated); userCard.IsActive = command.IsActive; Commit(); return(message); } catch (ServiceException) { throw; } catch (Exception ex) { throw new ServiceException("Cannot set card assignment.", ex); } }
public IHttpActionResult ActivateCard(SetCardActivationCommand command) { return(Ok(_cardAccountService.SetCardActivation(command))); }