public static dynamic ToOffice365UserChangeRolesCommand(this Office365UserChangeLicenseViewModel viewModel)
 {
     return(new
     {
         viewModel.CompanyId,
         viewModel.UserPrincipalName,
         viewModel.UserRoles
     });
 }
 public static dynamic ToManageSubscriptionsAndLicencesCommand(this Office365UserChangeLicenseViewModel viewModel)
 {
     return(new
     {
         viewModel.CompanyId,
         CloudPlusProductIdentifier = viewModel.AssignCloudPlusProductIdentifier,
         Users = new List <Office365UserViewModel> {
             new Office365UserViewModel {
                 UserPrincipalName = viewModel.UserPrincipalName
             }
         },
         viewModel.UserRoles,
         MessageType = ManageSubsctiptionAndLicenceCommandType.ChangeLicence
     });
 }
예제 #3
0
        public async Task <IHttpActionResult> ChangeLicense([FromBody] Office365UserChangeLicenseViewModel model)
        {
            var office365UserChangeLicense = Office365ServiceConstants.QueueManageSubscriptionsAndLicences;

            if (model.AssignCloudPlusProductIdentifier == model.RemoveCloudPlusProductIdentifier)
            {
                await _messageBroker.GetSendEndpoint(office365UserChangeLicense)
                .Send <IOffice365UserChangeRolesCommand>(model.ToOffice365UserChangeRolesCommand());
            }
            else
            {
                await _messageBroker.GetSendEndpoint(office365UserChangeLicense)
                .Send <IManageSubscriptionsAndLicencesCommand>(model.ToManageSubscriptionsAndLicencesCommand());
            }

            return(Ok());
        }