public IHttpActionResult Get([FromBody] UserRoleMapPK userRoleMapPK) { ThrowIfUserHasNoRole(readRole); using (MappingUserToRoleGroupQuery mappingUserToRoleGroupQuery = new MappingUserToRoleGroupQuery(Db)) { var data = mappingUserToRoleGroupQuery.GetByPrimaryKey(userRoleMapPK.RoleGroupPK, userRoleMapPK.UserPK); SaveLog("MappingUserToRoleGroup", "Get", JsonConvert.SerializeObject(new { primaryKey = userRoleMapPK.RoleGroupPK })); return(Ok(new SuccessResponse(data))); } }
public IHttpActionResult GetForm([FromBody] UserRoleMapPK userRoleMapPK) { ThrowIfUserHasNoRole(readRole); using (MappingUserToRoleGroupEntryDataProvider mappingUserToRoleGroupEntryDataProvider = new MappingUserToRoleGroupEntryDataProvider(Db, ActiveUser, AccessControl, new MappingUserToRoleGroupQuery(Db))) { var data = mappingUserToRoleGroupEntryDataProvider.Get(userRoleMapPK.RoleGroupPK, userRoleMapPK.UserPK); SaveLog("MappingUserToRoleGroup", "GetForm", JsonConvert.SerializeObject(new { primaryKey = userRoleMapPK.RoleGroupPK })); return(Ok(new SuccessResponse(data))); } }
public IHttpActionResult Delete([FromBody] UserRoleMapPK keys) { ThrowIfUserHasNoRole(deleteRole); if (keys == null) { throw new KairosException("Missing parameter: 'primary keys'"); } using (var mappingUserToRoleGroupDeleteHandler = new MappingUserToRoleGroupDeleteHandler(Db, ActiveUser)) { using (var transaction = new TransactionScope()) { var result = mappingUserToRoleGroupDeleteHandler.Execute(keys.RoleGroupPK, keys.UserPK, Base.DeleteMethod.Hard); transaction.Complete(); return(Ok(new SuccessResponse(result))); } } }