public async Task <ServiceResponse <bool> > AddRoleToUser(int userId, int roleId) { WCFProxy.AuthorisationManagerServerClient authorisationManagerServerClient = null; try { authorisationManagerServerClient = new WCFProxy.AuthorisationManagerServerClient(new WSHttpBinding(), new EndpointAddress(endpointAddress)); var result = await authorisationManagerServerClient.AddRoleToUserAsync(userId, roleId).ConfigureAwait(false); authorisationManagerServerClient.Close(); return(result); } catch (Exception ex) { if (authorisationManagerServerClient != null) { authorisationManagerServerClient.Abort(); } var serviceResponse = new ServiceResponse <bool>(ex.Message, true); return(serviceResponse); } }
public async Task <ServiceResponse <Role> > SaveRole(Role role) { WCFProxy.AuthorisationManagerServerClient authorisationManagerServerClient = null; try { authorisationManagerServerClient = new WCFProxy.AuthorisationManagerServerClient(new WSHttpBinding(), new EndpointAddress(endpointAddress)); var result = await authorisationManagerServerClient.SaveRoleAsync(role).ConfigureAwait(false); authorisationManagerServerClient.Close(); return(result); } catch (Exception ex) { if (authorisationManagerServerClient != null) { authorisationManagerServerClient.Abort(); } var serviceResponse = new ServiceResponse <Role>(ex.Message, true); return(serviceResponse); } }
public async Task <ServiceResponse <bool> > RemoveActivityFromActivity(int activityId, int parentId) { WCFProxy.AuthorisationManagerServerClient authorisationManagerServerClient = null; try { authorisationManagerServerClient = new WCFProxy.AuthorisationManagerServerClient(new WSHttpBinding(), new EndpointAddress(endpointAddress)); var result = await authorisationManagerServerClient.RemoveActivityFromActivityAsync(activityId, parentId).ConfigureAwait(false); authorisationManagerServerClient.Close(); return(result); } catch (Exception ex) { if (authorisationManagerServerClient != null) { authorisationManagerServerClient.Abort(); } var serviceResponse = new ServiceResponse <bool>(ex.Message, true); return(serviceResponse); } }